Previous | Next --- Slide 66 of 66
Back to Lecture Thumbnails
ArbitorOfTheFountain

I've noticed in addition to domain-specific languages, there is often an effort to hide domain-specific details below layers of abstraction. For example, OpenCV uses SSE or AVX when they are available. Isn't hiding those kinds of details in a library often a better choice than making a new language?

TomoA

@ArbitorOfTheFountain I think that a large advantage of DSL's is being able to define custom syntax suitable for the domain. It not only allows you to constrain the program for the sake of optimization, as we saw in Liszt and Halide, but it also allows you to write code that looks idiomatic to the problem at hand. As an easy example, ISPC is a DSL for writing simd code while SSE and AVX is essentially just a library allowing you to access vector instructions. I think we can agree that ISPC is much more productive precisely because we're not limited to constructs on available in C++, even disregarding the optimizations that the authors of ISPC might have made without your knowledge.

jerryzh

I think the choice of implementing a library or a DSL depends on the problem. Library support is much more lightweight than a DSL, and doesn't impose the cost of learning a new language for software engineers. The greatest advantage of DSL, I believe, is the optimizations that we can apply when we constrain the programs to a certain domain. And theses optimizations are actually "domain-specific" optimizations, in other words, it's the optimizations that typically more related to the domain knowledge, rather than the implementation details.