susam / fxyt

Tiny, esoteric, stack-based, postfix, canvas colouring language with only 36 simple commands
https://susam.net/fxyt.html
MIT License
117 stars 4 forks source link

Undefined behaviour for F and M commands #2

Closed novedevo closed 10 months ago

novedevo commented 10 months ago

Hi, I love your language! I'm writing an implementation of it over at https://github.com/mademast/fxyt and I noticed two areas where the spec leaves behaviour undefined: using M to increment the mode more than twice and using F to set different frame intervals for different spatial coordinates. From looking at your reference implementation, it looks like overincrementing the mode is an error, and the only frame interval that matters is the final pixel (all others are ignored). I may have misread, though.

I agree with the first behaviour, but maybe having F set different values based on the grid coordinates should be an error? Otherwise different implementations could behave differently depending on what order they render the image in. Each pixel could also set its own frame interval (could be visually interesting!), but that would significantly increase the complexity of a FXYT interpreter and introduce the issue of synchronization.

It would work to let F set different values based on the T coordinate; that makes intuitive sense to me.

(maybe setting the frame interval to a negative value should also be an error?)

Thanks for making this project! It's been a lot of fun throwing together a simple parser and interpreter for it.

susam commented 10 months ago

Hi @novedevo, Thank you for taking a close look at this project. I am glad you like it and you are making a Rust implementation of it! You are right about both things. I have pushed two commits to address the problems you identified.

  1. Commit a4cd667 to clarify in the documentation that it is an error to increment the mode number to 3.
  2. Commit e85c929 to consider negative frame intervals to be an error and also to only consider the frame interval set during the evaluation of the cell (0, 0) as the frame interval for the next frame.

Edit: A development version containing this update is now available at https://susam.github.io/fxyt/fxyt.html. I'll make it available at https://susam.net/fxyt.html after some more testing and usage.

susam commented 10 months ago

The fixes are now available as part of version 0.2.0 at https://susam.net/fxyt.html. Thanks once again for identifying these issues and for sharing your recommendations for fixing them.