Additional identifier characters (prime ' and question mark ? suffixes) #129

Closed
opened 2025-07-01 10:47:54 +02:00 by riki · 1 comment
Owner

I believe it would be nice and fun for readability if identifiers could be suffixed with any number of the following symbols:

  • ' - prime (math notation for indicating values derived from other values)
  • ? - question (for functions that answer a question. anything that returns boolean)

This is inspired by Ruby. We have ? but not Ruby's !, because it's the boolean NOT operator, and it wouldn't really solve anything—since haku does not have mutation at all. Maybe it would make sense for acts, as they represent side effects—like plotter! or stroke! but I'm not sure that gains us any readability. It just looks weird.

I believe it would be nice and fun for readability if identifiers could be suffixed with any number of the following symbols: - `'` - prime (math notation for indicating values derived from other values) - `?` - question (for functions that answer a question. anything that returns `boolean`) This is inspired by Ruby. We have `?` but not Ruby's `!`, because it's the boolean NOT operator, and it wouldn't really solve anything—since haku does not have mutation at all. _Maybe_ it would make sense for acts, as they represent side effects—like `plotter!` or `stroke!` but I'm not sure that gains us any readability. It just looks weird.
riki changed title from Symbols as identifiers suffixes to Symbols as identifier suffixes 2025-07-01 10:48:00 +02:00
riki added the
area/haku
goal/h2
labels 2025-07-01 10:48:08 +02:00
Author
Owner

Example with the builtin/dashes brush:

withDotter \d ->
  visible? = mod (d Num) length < length * duty
  if (visible?)
    stroke thickness color (line (d From) (d To))
  else
    ()
Example with the `builtin/dashes` brush: ``` withDotter \d -> visible? = mod (d Num) length < length * duty if (visible?) stroke thickness color (line (d From) (d To)) else () ```
riki changed title from Symbols as identifier suffixes to Additional identifier characters (prime ' and question mark ? suffixes) 2025-07-01 14:47:30 +02:00
riki closed this issue 2025-09-01 22:44:38 +02:00
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: riki/rkgk#129
No description provided.