-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The factorial example in the README does not work as expected #4
Comments
Hi Christopher, Thank you. You are correct. The binding of the variable in
But with a For the longest of time,
That's very naive for a number of reasons One of them is Earlier versions of the code have been working around this by special-casing it in the compiler (e.g. was the case in Tao3D), or trying to have a special annotation to the parameter (e.g. I believe I finally found the "right" way to express this, which is documented here, where the code will look like this:
Here are the things that are broken for this to work:
So this explains why I believe it will be a while until the Thanks a lot for reporting it, though. I will keep the issue open, and if/when I finally get the |
In order to show what some earlier implementations of the |
This can have something to do with immutability. Feel free to look at V lang (doc with examples) as a modern take on that (I like the "immutable by default" which I'm not sure XL could easily express (I have a feeling "mutable by default" should be doable in XL, but that partially defeats the added value of immutability). On the other hand I'm not exactly sure whether immutability is that useful in non-imperative style of programming. So if I understand the problem with Just my 2 cents 😉. |
The README shows the following code for a program that compute the factorial of 1 to 5:
I expect this to print:
However, the following is printed instead:
Environment:
gcc:latest
Docker image (Debian)Occurs in both interpreted (
xl -i file.xl
) and compiled (xl file.xl
) forms.The text was updated successfully, but these errors were encountered: