Closed askucher closed 6 years ago
you have unreadable syntax in both cases. imo.
I'd remember that you can write React in this way:
div do
className: 'book' # props
Presentation.render @props.data, @props.scale # children
The compiler does not know that func
is indeed a function.
You have to provide a hint to create an argument-list from this code-block
@igl please read it https://hackernoon.com/react-livescript-livescript-2-0-164d35ca5373#.q5m3pjmdl
@askucher, getting rid of the do
would indeed make your DSL look nicer, but if you want to understand why having to write the do
is useful, you should probably look at some different applications of LiveScript.
For example, here's some LiveScript that works today that would mean something different if LS had indentation-based do
inference:
args =
\--options silent-opt
noninteractive-opt
\-- filename
This snippet takes advantage of the fact that indentation is irrelevant inside a list, and is obviously not intended to mean
args =
\--options silent-opt do
noninteractive-opt
\-- filename
I agree on the DSL pro, that's why I tried it out in (LS-inspired) Onyx... https://github.com/ozra/onyx-lang/issues/60#issuecomment-201954355 - sure it has type inference - but parsing is done before typing (to avoid the hellishly slow C++-compile times), so it would obviously work in JS-transpile-lang, if it wasn't for wasting possibilities on... not so necessary features. LS has been very good to me over the years (still use it daily aside from the to-native langs) - but there can definitely be something better.
I am asking because trying to implement pug like syntax based on LiveScript and attract React developers (https://github.com/flyber-net/lsx-pug)