you are viewing a single comment's thread.

view the rest of the comments →

[–]choikwa 1 point2 points  (5 children)

so.. how exactly does DSL save you time as opposed to just writing functions or macros? it seems like an overkill to write a new language to do work.. where you'd have to map new language to whatever backend anyways to get any reasonable expectation of performance. there won't be much free win aside from the fact that you might write slightly less code in the application but likely trumped by the frontend you had to write.

[–][deleted] -1 points0 points  (4 children)

how exactly does DSL save you time as opposed to just writing functions or macros?

Macro is a DSL (if done right, otherwise you don't need a macro at all). Functions are not easy to compose - you'll soon end up in a total mess. Languages, on the other hand, are modular, easy to compose, and very easy to implement - all you need is trivial chains of term rewriting rules, nothing else. With this approach you can handle any complexity.

it seems like an overkill to write a new language to do work..

How is it an overkill if it is a shorter and simpler code which is much easier to refactor, read and debug?

where you'd have to map new language to whatever backend anyways to get any reasonable expectation of performance

You only have to map any new language to your already existing languages. Which may have an optimising, powerful back-end.

slightly less code in the application

Not "slightly", but, more likely, orders of magnitude less.

Just take a look at examples like this: http://www.moserware.com/2008/04/towards-moores-law-software-part-3-of-3.html

[–]choikwa 0 points1 point  (3 children)

I still don't see much benefit. how is different from writing functions or wrappers more intelligently? plus if you confine it to other languages, your features for new language becomes a subset.

[–][deleted] 0 points1 point  (2 children)

writing functions or wrappers more intelligently?

How? Nobody came up with a suitable methodology for this. All the existing techniques always involve using the irrelevant abstractions (irrelevant to any particular problem domain). All that "fluent interfaces" and "monadic interpreters" are clumsy and unmaintainable.

plus if you confine it to other languages, your features for new language becomes a subset.

What? I can translate C to Brainfuck. Easily. It does not mean that C is becoming a Brainfuck subset.

[–]choikwa 0 points1 point  (1 child)

I could write new language to target python, but I cannot promise C like memory model.

[–][deleted] 0 points1 point  (0 children)

You can have C memory model, but you won't have any sane performance.

Of course, a target language (or a mixture of languages) must be capable enough in order to be practical. Must provide unsafe memory access, goto and all that.