[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Are parenthesis-free calls a Good? (was Re: patch: C-style string lexing)
- From: "Paul Moore" <p.f.moore@...>
- Date: Thu, 31 Jan 2008 17:36:49 +0000
On 31/01/2008, Brandon Van Every <firstname.lastname@example.org> wrote:
> I've been lurking around here trying to decide if there's value in
> using Lua as an embedded language for the CMake cross-platform build
> tool. http://www.cmake.org Although the conversations I'm reading on
> the list are stimulating from an experimental language design
> standpoint, it's making me wonder how mature Lua actually is, or how
> complicated it's actually going to become.
Interesting. I've been lurking as well, and my reaction was entirely
the opposite. I saw the example you quoted, and thought "that's a
really nice and readable way of writing a domain-specific language".
Certainly, I wouldn't use this style in general purpose code - when
you're writing what is visibly conventional code, using conventional
syntax makes complete sense. But when you are writing (say) a
configuration file, where the general language is used in a very
constrained and stylised form, being able to avoid superfluous syntax
can help immensely.
The example was somewhat misleading in that using foo/bar/baz doesn't
give much context. But look at an earlier example:
class "Foo" : extends "Bar"
Technically, that's a call to the function class, with a single
argument, the string "Foo". The result is then combined with the colon
operator to the method name extends, and the extends method is then
called with the argument "Bar". (I hope I got that right!!!)
But the technicality is irrelevant - the result is a very nice class
definition syntax - far nicer than you'd get if you had to use
conventional syntax with parentheses.
> Arcana in the language usage doesn't help that.
But stylised conventions for specific cases counteracts that, in my view.