-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
all: only allow defining ==
and <
and auto generate !=
, >
, >=
and <=
#8520
Conversation
The CI Error is not related to my PR. |
Good work! But wasn't the decision to only allow defining |
|
I feel having |
I believe this implementation is fine as it is. We cannot restrict the user more than this. 🙂 |
well, we can, if we disallow overloading one more operator 😉 |
As said hope it's the last time we touch this feature, so don't be that hurry. |
==
, <
and <=
and auto generate !=
, >
and <=
==
and <
and auto generate !=
, >
, >=
and <=
@SleepyRoy a great summary. |
Great job! A good simplification of the language. |
I'm afraid we should definitely allow Defining own methods for such composed operators is an easy way to get adequate performance. |
@dumblob Also note that |
Yes, of course Now the choice is made by V and not the programmer. So maybe allow defining either of |
@dumblob thanks for elaborating on it and I basically got your idea. I'm OK with your suggestion of allowing only one from |
But still it would be better to have some examples and let's analyze whether it's worth having this feature. I don't think one negation operation would be costly. |
@dumblob can you please join the discord server so that we can further discuss on this more? |
Well, for floats it will 😢. @Delta456 I'd like to, but I won't be fast to respond interactively - I have hundreds of emails to read and thus I do things in batches. Feel free to discuss it there without me. Potentially we can do the "either of < >" thing after V 1.0 gets released as it sounds like 100% backwards compatible change/extension. |
@dumblob As per the discussion it has been stated that floating point comparison and equality are exact. It used to be approximate, but it has been reverted. Only able to use For approximate comparison and user-defined tolerance we will have |
@Delta456 this is a misunderstanding - please read carefully #5180 (comment) .
No, this is fully incorrect. Please accept this fact (as I begged already in the original thread). There is nothing like exact comparison of inherently approximate representations (this is by definition and that's why I strongly suggest V not allowing any comparison between approximate data types by default without the programmer explicitly visibly choosing how to approach comparisons of approximate information). Sounds theoretical? In practice you can test it yourself on your very own CPU - do millions of times the same C-style comparison in an (unoptimized) loop and at the same time do some other stuff on the same physical core (e.g. play a game or whatever). You'll see, that you'll get sometimes the comparison differently. Please comment in the "float" thread and not here.
I fully agree (as I said, to get rid of the additional negation we can enhance V some time after V 1.0 - if it proves valuable - by supporting something more as it'll be backwards compatible).
Again, this is totally fine. What I'm complaining about is the default behavior which is currently undefined and thus wrong (both in theory and in practice). So, introducing |
No description provided.