|Prefix, infix and function-call and their implications in embedded lan email@example.com (Peng Yu) (2010-01-20)|
|Re: Prefix, infix and function-call and their implications in embedded firstname.lastname@example.org (glen herrmannsfeldt) (2010-01-21)|
|Re: Prefix, infix and function-call and their implications in embedded email@example.com (Philip Herron) (2010-01-21)|
|Re: Prefix, infix and function-call and their implications in embedded firstname.lastname@example.org (Kaz Kylheku) (2010-01-21)|
|Re: Prefix, infix and function-call and their implications in embedded email@example.com (bartc) (2010-01-21)|
|Re: Prefix, infix and function-call and their implications in embedded firstname.lastname@example.org (Stefan Monnier) (2010-01-25)|
|From:||Philip Herron <email@example.com>|
|Date:||Thu, 21 Jan 2010 13:35:31 +0000|
|Posted-Date:||21 Jan 2010 14:52:41 EST|
On Wed, 2010-01-20 at 20:53 -0800, Peng Yu wrote:
> Consider the following three expressions, which are valid C, mit-
> scheme and Mathematica expressions. There are of course many other
> expressions that express the same thing in other languages, or in the
> same language but other different ways.
> (> (+ 3 (* 2 5)) 7)
> Apparently, at least to me, the first expression is the most readable.
> One possible reason is that we learn this algebraic notation much
> earlier than the other two, which is in analogy to that we can respond
> to the native language (say, English) much faster than to a second
> language (say, French).
> Readability affects the programmer productivity. Since embedded
> language can be embedded in a computer language, such scheme and C++,
> the choice of prefix, infix and function-call can profound affect the
> readability of the embedded language. I haven't found any previous
> references on this issue. Could somebody recommend me some if there
> [I suspect it's like underwear, you like what you're used to, and you can't
> really do meaningful comparisons because everyone already is familiar with
> something. -John]
Just adding my $0.02, but readability wise I think most people will say
the first one since that's the way were taught to do Math. Though i am
sure alot of people will say the scheme one, some argue its more
powerful, but really its only powerful from the perspective of a
programming language implementation, since you have to do very little
work to parse this; means you can be very linear and lazy in how your
implementation works since all the recursion is left up to the
programmer to figure out and write correctly.
In my language I translate expressions like ( 3+2... ) into a scheme'ish
IR and I evaluate of this in my runtime. Note: if your building an
implementation of a language, functional languages like scheme and lisp
are nice to (think-about/look-at) on how to handle recursion even if you
don't like the language it should help even a little to see how you
_might_ structure things from a different perspective (well it helped me
Though for looking into documents on the readability I doubt you will
find much on this since its up to a language designer to think about
what they want it to look like. I guess if you find something it may be
a very abstract view on readability in general.
Return to the
Search the comp.compilers archives again.