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

Add a green check #91

Open
2 of 6 tasks
labbo-lab opened this issue Jun 5, 2023 · 22 comments
Open
2 of 6 tasks

Add a green check #91

labbo-lab opened this issue Jun 5, 2023 · 22 comments

Comments

@labbo-lab
Copy link
Contributor

labbo-lab commented Jun 5, 2023

Add a built-in function to check if the given value is green or not.

greenCheck(green); //true
greenCheck("green"); //true
greenCheck("#00FF00"); //true
greenCheck("rgb(0,255,0)"); //true

greenCheck(red); //false
greenCheck(1); //false
greenCheck("blue"); //false
greenCheck("rgb(255,255,0)") //false

TODO:

  • List of every present and future way of describing the color green
  • Truth table for every other color and it's distance from green, using false, maybe and true
  • handle user colorblindness
  • research color spaces
  • remember how to code
  • full color space list
@mitiko
Copy link

mitiko commented Jun 5, 2023

How would we handle greenCheck(blue + yellow)?

@labbo-lab
Copy link
Contributor Author

How would we handle greenCheck(blue + yellow)?

Some sort of color mixing would need to be implemented, or just a truth table (This could get out of hand rather quickly though

@labbo-lab
Copy link
Contributor Author

Python implementation for if #74 ever wants to implement this

(sorry if this is bad, its been a bit since i last used python so im a bit rusty, used to javascript now)

def checkGreen(i):
  if (isinstance(i, str) or callable(i)):
    if i == "green" or i == "rbg(0,255,0)" or i == "rbg(0, 255, 0)" or i == "0,255,0" or i == "0, 255, 0"  or i == "#00FF00" or i == "rbg(0,255,0)":
      return True;
    elif hasattr(i, "__name__"):
      if i.__name__ == "green" or i.__name__ == "Green":
        return True
  else:
    return False
  return False 

@MaxenceDC
Copy link

Wouldn't it make more sense as an external module/crate/library/package/whateveritscalledinthislang?

@labbo-lab
Copy link
Contributor Author

Wouldn't it make more sense as an external module/crate/library/package/whateveritscalledinthislang?

It would be much more fitting as a built in function, since this is a rather commonly needed function

@MaxenceDC
Copy link

MaxenceDC commented Jun 5, 2023

greenCheck(green); //true

what if I define the immutable const const const like that? :

const const const green = "rgb(255,255,0)"!

That would be rude, so I won't do that but someone else could...
Also this function might aswell support HSL, RGBA and the bizillion+ different formats of color storing that exists ; so a better color interpretation algorithm might be needed instead of hard-checking the variable.

(By the way I'm not sure what the ; (not operator) stands for at the end of each line of your examples, did you intend to write ! instead?)

@MaxenceDC
Copy link

(oh and where do we draw the line between green and blue?)

@labbo-lab
Copy link
Contributor Author

(oh and where do we draw the line between green and blue?)

Exactly on green, if the user wants to get a color close to green they would use checkApproxGreen()

@labbo-lab
Copy link
Contributor Author

labbo-lab commented Jun 5, 2023

greenCheck(green); //true

what if I define the immutable const const const like that? :

const const const green = "rgb(255,255,0)"!

That would be rude, so I won't do that but someone else could... Also this function might aswell support HSL, RGBA and the bizillion+ different formats of color storing that exists ; so a better color interpretation algorithm might be needed instead of hard-checking the variable.

(By the way I'm not sure what the ; (not operator) stands for at the end of each line of your examples, did you intend to write ! instead?)

The check could go deeper, we may need to philosophically define green to avoid any edge cases

We're gonna need a large truth table, and the implementation was written in a DreamBerd competitor called "Pythom" or something so it uses a weird operator at the end of lines

@MaxenceDC
Copy link

MaxenceDC commented Jun 5, 2023

checkApproxGreen()

Which returns a boolean being false, true or maybe based on how far it is from greenest green

@labbo-lab
Copy link
Contributor Author

labbo-lab commented Jun 5, 2023

@mitiko
Copy link

mitiko commented Jun 5, 2023

we should be inclusive to colorblind users, the compiler needs to check if the user is colorblind and if so only ever return maybe

However there is the rare case when a user turned colorblind in which case we must record the exact time so code executing before that would have it's regular behavior..

@MaxenceDC
Copy link

Wait, can you turn colorblind?

@labbo-lab
Copy link
Contributor Author

we should be inclusive to colorblind users, the compiler needs to check if the user is colorblind and if so only ever return maybe

However there is the rare case when a user turned colorblind in which case we must record the exact time so code executing before that would have it's regular behavior..

todo: implement a way to interface with reality to check if user is colorblind and the exact time of the change.

@TodePond
Copy link
Owner

TodePond commented Jun 5, 2023

this is more complex than I first thought

@labbo-lab
Copy link
Contributor Author

this is more complex than I first thought

This is just for the green specification, we still have to do all the other visible colors, along with invisible colors such as ultraviolet and infrared

@labbo-lab
Copy link
Contributor Author

added a task list

@labbo-lab
Copy link
Contributor Author

You know, there are times when I wish i was joking (I'm sure I missed plenty, and I still need to add all the variants for the color spaces)

greenList.csv

@k2d222
Copy link

k2d222 commented Jun 7, 2023

we should be inclusive to colorblind users, the compiler needs to check if the user is colorblind and if so only ever return maybe

However there is the rare case when a user turned colorblind in which case we must record the exact time so code executing before that would have it's regular behavior..

There is definitely room for a race condition there, and very nasty compiler bugs!

Scenario: a compiler runs greenCheck: it tests user blindness, then computes function result. What if user turns blind between the test and the output?

@mitiko
Copy link

mitiko commented Jun 7, 2023

Oh, I thought we had that "atomic shield" thing that allows us to execute instructions in exactly 0 seconds:

  • first the instructions are executed and the timing recorded
  • next we travel back in time exactly this much time before the atomic execution is started
  • we run the instructions back in time and they finish just when its result is needed - aka instantaneous

I guess that is pretty complex on its own, I shall open a new issue about it

Update: there's a wikipedia page on this: https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use

@omentic
Copy link

omentic commented Jun 9, 2023

However there is the rare case when a user turned colorblind in which case we must record the exact time so code executing before that would have it's regular behavior..

Mmm, I think lifetime annotations can be leveraged for this purpose. The near-exclusive use of seconds always struck me as limiting. If we introduce binding to something other than static time units, ex. actual real-world life times, that would solve this problem as a result (simply bind to the retina, and write a destructor). It might introduce some other issues: undecidability? armageddon? idk

@k2d222
Copy link

k2d222 commented Jun 9, 2023

Hmm that could be done but I think we are waaaayyyy too overcomplicating things here.

What I propose instead, is that we simply

  • check the medical record of the user at runtime (which can easily be done through an API call),
  • compute a probability of turning blind/color blind (or recovering sight/color vision, which we should not forget about),
  • return maybe green in case the probability is above a threshold.

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

6 participants