Skip to content
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

Experimental bitfield feature #203

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

yaxu
Copy link

@yaxu yaxu commented Nov 3, 2024

image

Implements bitfields:
https://forum.algorithmicpattern.org/t/bytebeat-tixyland-and-other-functions-of-time/396

Inspired by their visual similarity to some weaving patterns:
https://forum.algorithmicpattern.org/t/weaving/359/2?u=yaxu

Warning, this uses eval(), so shouldn't be merged until the input validation is verified as safe. Otherwise folks might run untrusted javascript in their browser by loading a pattern shared by an evil weaver, who then might sabotage their saved drafts!

@yaxu yaxu marked this pull request as draft November 3, 2024 12:14
@yaxu yaxu marked this pull request as ready for review November 3, 2024 16:25
@yaxu
Copy link
Author

yaxu commented Nov 3, 2024

The regex might be enough to make this secure now.. Could be better though, e.g. with useful parse errors.

@yaxu yaxu changed the title Experimental bitfield feature (warning - has security implications!) Experimental bitfield feature Nov 3, 2024
@yaxu
Copy link
Author

yaxu commented Nov 4, 2024

Now redone with mathjs expressions https://mathjs.org/docs/expressions/parsing.html

I just had to hack ^ to be parsed as ^|, as mathjs uses that for the bitwise 'not' used a lot in bitfields.

(With thanks to [email protected] )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant