First of all, thanks for such a detailed answer.
Actually it was my first experience with language design so I used more “practical” terms from my day-to-day usage. I would like VAR := func(ARGS)
syntax but it’s contrary to existing
“everything is a command()” design.
I was thinking about something like std::tie()
, e.g. list(TIE list_var VAR1 VAR2)
.
What complexity are you talking about? Complexity of implementation or run-time cost? Regarding implementation one, yes it’s requires some big changes but I believe it’s worth it. In my implementation there’s no big difference between evaluating f(${g()})
and combination of g(RETVAR) + f(${RETVAR})
. No big run-time
cost either.
I don’t understand why it’s counter to declarative style. It helps to hide
implementation details, isn’t it the goal of declarative programming?
Maybe it’s a matter of taste but I think that function calls are better than direct value manipulations. Who should initially compute and set them? We can’t predict all use cases, so user should initialize them somewhere.
It’s there only for demonstration, I don’t like deeply nested calls either.
Your fun_expr example is great, the only detail I don’t like is the necessary to have that NAME var. I think that it should be more flexible and allow user to decide whether they wants to store it in the var. Again, isn’t it against declarative style to force user to create unneeded variables? Also don’t you think that while extending it to handle more complex cases we’re actually doing parser’s job? I mean, yes, maybe you can do it in your custom library, but one of my goals was to make CMake more user-friendly and convenient to people from another languages, that’s why I believe that such feature should be built-in rather than provided by third-party library.