# For some this might be a DSL; for us it would likely be just Julia :-)

**URL:** <https://discourse.julialang.org/t/for-some-this-might-be-a-dsl-for-us-it-would-likely-be-just-julia/118433>\
**Category:** Offtopic\
**Created:** [August 20, 2024, 11:48pm UTC](https://discourse.julialang.org/t/for-some-this-might-be-a-dsl-for-us-it-would-likely-be-just-julia/118433 "2024-08-20T23:48:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [August 20, 2024, 11:48pm UTC](https://discourse.julialang.org/t/for-some-this-might-be-a-dsl-for-us-it-would-likely-be-just-julia/118433/1 "2024-08-20T23:48:32Z")

</div>

![image](https://global.discourse-cdn.com/julialang/original/3X/5/a/5a01a1f4ae70517c242e7d5b70b24a3bd3b840ed.png)

> **[Assembling a High-Productivity DSL for Computational Fluid Dynamics |...](https://dl.acm.org/doi/10.1145/3324989.3325721)**

---

<div class="post-metadata">

**Author:** ![xiaoxi](https://avatars.discourse-cdn.com/v4/letter/x/a9adbd/32.png) [@xiaoxi](https://discourse.julialang.org/u/xiaoxi)\
**Post date:** [August 21, 2024, 7:05am UTC](https://discourse.julialang.org/t/for-some-this-might-be-a-dsl-for-us-it-would-likely-be-just-julia/118433/2 "2024-08-21T07:05:19Z")

</div>

I wonder if this code in Julia would be quicker and clearer.

---

<div class="post-metadata">

**Author:** ![CameronBieganek](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cameronbieganek/32/6915_2.png) [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Post date:** [August 21, 2024, 1:34pm UTC](https://discourse.julialang.org/t/for-some-this-might-be-a-dsl-for-us-it-would-likely-be-just-julia/118433/3 "2024-08-21T13:34:59Z")

</div>

This would be a DSL in Julia, too. According to the abstract, the DSL is a high-level declarative specification of a CFD problem, which then gets automatically transformed into the low-level, parallel numerical code. So, it’s similar in spirit to the DSL that ModelingToolkit.jl provides.

The overall approach to creating a CFD DSL like this is the same regardless of the language used.

---

<div class="post-metadata">

**Author:** ![Satvik](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/satvik/32/20486_2.png) [@Satvik](https://discourse.julialang.org/u/Satvik)\
**Post date:** [August 21, 2024, 4:42pm UTC](https://discourse.julialang.org/t/for-some-this-might-be-a-dsl-for-us-it-would-likely-be-just-julia/118433/4 "2024-08-21T16:42:10Z")

</div>

The syntax is very verbose, but I think this has more to do with wanting to make the translation between Saiph and Scala very simple, and the DAG of computations explicit. You could design a more Julia-like syntax that gets executed in parallel, the disadvantage of this is that the translation becomes less obvious and debugging is harder.

My job actually does something similar. We add a bunch of expressions to a DAG, and then evaluate the DAG all at once, deduplicating and executing in parallel. We do this using Julia `exprs` and macros. For example, we might have something like:

```julia
dag = DAG()
d = .001u"m"^2 / u"s"
d2 = d^2
add_expr!(dag, d^2)

```

Where macros behind the scenes ensure that `d` is recorded as a dependency of `d^2`. In our case, all our expressions are large arrays, so this sort of overhead makes sense.
