let doesn't seem to be working correctly #78

Closed
opened 2024-09-01 22:50:36 +02:00 by liquidev · 1 comment
liquidev commented 2024-09-01 22:50:36 +02:00 (Migrated from github.com)
get_color = \radius ->
  rgba 255 0 0 0

splat = \radius ->
  let color = get_color radius
  fill color (circle 0 0 0)

[
  splat 64
  splat 64
]
an exception occurred: 1st argument to `fill` must be a color (rgba)

It's pretty clear from the example that color should be an rgba, but it for some reason isn't. Probably because the let becomes deinitialized too early, or never initialized quite right?

It's weird because if you only call splat once, then it doesn't error out:

get_color = \radius ->
  rgba 255 0 0 0

splat = \radius ->
  let color = get_color radius
  fill color (circle 0 0 0)

[
  splat 64
]
``` get_color = \radius -> rgba 255 0 0 0 splat = \radius -> let color = get_color radius fill color (circle 0 0 0) [ splat 64 splat 64 ] ``` ``` an exception occurred: 1st argument to `fill` must be a color (rgba) ``` It's pretty clear from the example that `color` should be an `rgba`, but it for some reason isn't. Probably because the `let` becomes deinitialized too early, or never initialized quite right? It's weird because if you only call `splat` once, then it doesn't error out: ``` get_color = \radius -> rgba 255 0 0 0 splat = \radius -> let color = get_color radius fill color (circle 0 0 0) [ splat 64 ] ```
liquidev commented 2024-09-02 21:14:07 +02:00 (Migrated from github.com)

Excuse the four spaces, but I managed to minify the example further:

f = \_ ->
    let x = 1
    x + x

[
    f ()
    f ()
]
Excuse the four spaces, but I managed to minify the example further: ``` f = \_ -> let x = 1 x + x [ f () f () ] ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: liquidex/rkgk#78
No description provided.