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

Improving for loops / for loops could support tuples #67

Open
davesmith00000 opened this issue Dec 29, 2022 · 0 comments
Open

Improving for loops / for loops could support tuples #67

davesmith00000 opened this issue Dec 29, 2022 · 0 comments

Comments

@davesmith00000
Copy link
Member

davesmith00000 commented Dec 29, 2022

A collision of langugaes!

Scala has no c-like for loops on the notion that we use for for other things and anything you can encode as a for loop you can encode as a while loop.

for loops in GLSL are a big thing however, especially in demoscene-like code-golfing, but also because support for while loops is not universal across graphics hardware. 🙀 *

Things like this are common:

for(int i = 0, j = count - 1; i < count; j = i, i++) {
  ...
}

And that is tame compared to this:

vec2 p;for(float i,f;i++<1e1;o+=(1e1-f)/max(length(p=mod((FC.xy*2.-r)/r.y*f*rotate2D(i),2.)-1.)+cos(atan(p.y,p.x)*5.+t*cos(i))/3e1-vec4(7,8,9,0)/6e1,.01)/8e2)f=mod(i-t,1e1);

It would be nice, as a nod towards the former case to be able to use tuples as the initial type.

I also note that above we have a Float for i and I'm not sure we support that either? - Checked, this works fine.

(* Could be wrong / could be out of date advice)

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

No branches or pull requests

1 participant