News for hackers. Stuff that matters.
Re:Reader macros in Common Lisp by sklogic on Monday October 19, 2015 @04:43AM (#10411814)
And what is wrong, exactly, with changing the language syntax?

DSLs become more readable and closer to the way the problem domain experts think if they are using the more convenient syntax.

Re:Reader macros in Common Lisp by TeMPOraL on Monday October 19, 2015 @04:53AM (#10411845)
Personally I think it's totally cool as long as you stay consistent and your language makes sense.

It is written in SICP that programming is in fact building layers of abstraction, the lower one serving as a programming language for the higher one. Macros or not, everyone designs new 'programming languages', though today's term of art is "API".

Re:Reader macros in Common Lisp by jlg23 on Monday October 19, 2015 @08:12AM (#10412358)
There is nothing wrong if you can justify it to the next programmer who has to deal with your code. If your gain is only marginal but I have to read and understand 200 lines of code to understand your DSL, I might be mildly annoyed....
Re:Reader macros in Common Lisp by armitron on Monday October 19, 2015 @09:21AM (#10412699)
You know there is such a thing as documentation right?

If you have to read and understand 200 lines of code with no documentation, take it up with the incompetent developer.

This argument holds no water whatsoever. Bad programmers can cause all sorts of damage, why should everything be dialed down to their level?

Clojure forces you to deal with concurrency issues in a way that might be premature optimization at best, tremendous waste of time at worst. As opposed to DSLs in CL with reader macros, I have no choice in the matter, it's all or nothing. Yet I don't see you complaining.

Good DSLs (meaning they map very well to the problem domain ) are irreplaceable. They can make a problem completely disappear.

Re:Reader macros in Common Lisp by sklogic on Monday October 19, 2015 @09:24AM (#10412718)
A well-designed DSL should be self-documenting and obvious. And the right tools (like a proper IDE integration, with syntax highlighting and autocompletion) would make such a DSL much more obvious than a library of functions (which still must be thoroughly documented to be usable).
Re:Reader macros in Common Lisp by zzalpha on Monday October 19, 2015 @01:00PM (#10414132)
A well-designed DSL should be self-documenting and obvious.

ROFL. You're adorable. :)

You're also conveniently ignoring the maintenance required on the DSL itself. DSLs are, themselves, code, and code must be tested, updated, will likely experience regressions, etc.

Re:Reader macros in Common Lisp by sklogic on Monday October 19, 2015 @02:59PM (#10414845)
I've been building properly designed, syntactically rich DSLs for over a decade. It is much, much easier than building usable APIs.

DSL compilers are the simplest and cleanest code possible. They're nothing but a chain of very trivial tree rewrites, and with a help of a proper DSL you can write and maintain them easily.

Re:Reader macros in Common Lisp by chaitanya on Monday October 19, 2015 @10:27AM (#10413077)
While I don't think readability is a problem if you are judicious with your use of reader macros, the real problem is that they don't play well with editing tools e.g. all those nice Emacs shortcuts like forward-sexp, backward-sexp, etc. won't work correctly with any JSON that you write in your Lisp files.

Forget JSON, the problems are evident even when using something like CL-INTERPOL, which makes minimal changes to the read-table.

Re:Reader macros in Common Lisp by sklogic on Monday October 19, 2015 @10:48AM (#10413227)
Yes, of course you need your IDE to play well with the reader macros. That's why I use PEGs to construct such macros and to provide a feedback for the IDE while parsing (e.g., token locations, definitions, etc.).
Re:Reader macros in Common Lisp by lubonay on Monday October 19, 2015 @09:56AM (#10412900)
Programming languages carry with them certain conventions. Straying too much from the established code style will make your code a pain to work with.

It's pretty hard to hit the right balance between adhering to the original language and matching your DSL to the problem domain. If you build a DSL that requires a day of studying code and documentation in order to make a minor change, you might be better off without it.

Re:Reader macros in Common Lisp by sklogic on Monday October 19, 2015 @10:25AM (#10413060)
> Straying too much from the established code style will make your code a pain to work with.

This is a theory. Reality is a bit different. There is nothing in common between, say, JavaScript and the regular expressions DSL embedded into it, but yet they come ok together.

Code style is overrated.

Re:Reader macros in Common Lisp by zzalpha on Monday October 19, 2015 @01:01PM (#10414137)
The difference is that's a standard embedded DSL (another excellent example is C#'s LINQ).

Inventing your own alien syntax is a recipe for long-term code maintenance disaster. Anyone who's worked on a codebase that's lived longer than a decade has likely experienced this pain firsthand.

Re:Reader macros in Common Lisp by sklogic on Monday October 19, 2015 @03:01PM (#10414856)
Most of the code I worked with was 30-40 years old. Often full of ad hoc DSLs. Refreshing this kind of code was easier than any other kinds - rewriting the DSL itself with the modern technologies was sufficient, 90% of the remaining code base did not need much maintenance then.
Re:Reader macros in Common Lisp by arethuza on Monday October 19, 2015 @04:52AM (#10411841)
Because if there is no explanation of what the new syntax is and it's one developers take on making Lisp look a bit more pascally (which this was - it wasn't a DSL) I don't really see what it achieves other than confusion.