On Mon, 2024-12-09 at 01:49 -0800, Pete Dietl wrote: > Mon, 9 Dec 2024 10:37:14 +0100, Jouke Witteveen wrote: > > What I remember from the original thread is that we first needed a > > good proposal. I'm afraid the existence of the implementation > > suggested now sidesteps the discussion on what functionality is > > actually desirable. > > Yeah I'm totally open to discussing a proposal further. I just felt > like having some working prototype implemented would be useful.
In my opinion the patch is a proposal. If we decide it's best to do something completely different, then that's what we'll do. No doubt whatever we decide the user interface should be, at least big chunks of this code can be re-used anyway. Hopefully this won't be a shock to Pete :) I agree that the big open question from the previous discussion was, multiple individual functions versus one function that accepts a "math string". And if the latter, what is the syntax of that string. I liked the idea of a single function, as it seems simpler to use, but certainly it requires more decisions and discussion. > > I don't see the advantage in creating this special case. If someone > > wants the negation of a value, wouldn't they just write "-$V" instead > > of "$(sub $V)"? > > This feels similar to many concerns raised in the original thread > four years ago. In this particular case, "-$V" could result in two > consecutive minus signs, which is probably not what we want. I'm not sure why not, as long as the code handles it (I don't think this code does, admittedly). Can't you just consider --5 to be the same as -(-5), or 5, which is the same thing that $(sub -5) gives (I think)? > personally I still think arithmetic operators may be too much feature > creep altogether. I think I don't agree. For one thing we already have the concept of "numbers", because we provide the $(words ...) and, maybe less convincingly, $(word ...) functions. It's just that we can't really do much with them yet. I get the instinct to keep the language "clean" but in the end, people want to write build tools more than they want a clean language :). Being able to do basic math without having to shell out (not portable) or link with Guile or write some C code for a loadable module, doesn't seem like we're going out too far on the ledge.