-
Notifications
You must be signed in to change notification settings - Fork 30
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
Use Size when it should be used. #783
Comments
Let us also change the properties of all size covers into |
Change |
Suggestions: |
What about |
Are we keeping |
Just brain storming... |
Can collect first and then make pick the best, please? |
This has probably been brought up before but I'd like to point (hehe) out that the |
|
Ok. We can also discuss if |
If we're gonna make this change, I would prefer to clean up the things @marcusnaslund mentioned. Otherwise we're just exchanging a half-weird system for another. |
In computer graphics the terms are location vector and direction vector. |
So I would suggest, remove all the things that are actually vector-related and move them into a general vector class, FloatVector2D. Keep the FloatPoints, but more specific. |
"Real" |
I thought a point was a vector... 😕 |
Yes... well... it depends. In my world everything are tupels :-) |
Personally, I can live with |
If we are changing the properties in |
Talked with Simon today. He agreed with the idea of vectors + points, with the width, height, depth renamed to x, y and z. That means we are ready to fix this, but it is quite a big project. We should discuss who is going to to what. Volunteers welcome! |
Haha, how fun for the person who has to review that PR! Oh wait.. |
Just wanted to say that I tried this, and it works, with no warnings and no errors from valgrind: Vector: cover {
x, y: Int
init: func@
}
Point: cover from Vector extends Vector {
init: func@
scalarProduct: func (other: This) -> Int { this x * other x + this y * other y }
}
Size: cover from Vector extends Vector {
init: func@
width: Int { get { this x } }
height: Int { get { this y } }
area ::= this width * this height
}
vector := Vector new()
vector x = 2
vector y = 3
size := vector as Size
size width toString() println() // prints 2, yay
size height toString() println() // prints 3, yay
size area toString() println() // prints 6, yay
point := size as Point
point scalarProduct(point) toString() println() // prints 13, yay I haven't figured out how to set a |
Fixed it: Vector: cover {
x, y: Int
init: func@
}
Point: cover from Vector extends Vector {
init: func@
scalarProduct: func (other: This) -> Int { this x * other x + this y * other y }
}
Size: cover from Vector extends Vector {
init: func@
width: extern (x) Int
height: extern (y) Int
area ::= this width * this height
}
vector := Vector new()
vector x = 2
vector y = 3
size := vector as Size
size width toString() println() // prints 2
size width = 4
size width toString() println() // prints 4
size height toString() println() // prints 3
size area toString() println() // prints 12
point := size as Point
point scalarProduct(point) toString() println() // prints 25, yay So that means we can treat covers like objects with inheritance (sort of), and we can access Pretty neat, huh? |
Can you access |
I added Vector: cover {
x, y: Int
init: func@
foo: func -> Int { this x + this y }
} and
and it works, so think the answer is yes. |
I don't know about you, but ooc (as a programming language) suddenly looks a whole lot better to me. |
If it works properly, this would make this issue a whooole lot easier, and improve the code we have today a lot too. Let's hope we don't encounter any serious issues with it. I'm still a bit suspicious about the |
I'm not sure about the EDIT: I checked with Amos:
so we should use |
That is awesome! So what about the naming problem? Since I suggest
What do you think? |
real: extern (x) Float
imaginary: extern (y) Float |
Sounds reasonable. |
+1 for this latest suggestion. And this new-found feature looks awesome, so I had to try it out for a bit. It seems you have to declare getters and setters for variables in the base cover, otherwise things like
|
Can someone make some issues, so we can start working on these changes? |
@tomasmahlberg That's... a big problem. I reported it here: ooc-lang/rock#949 |
Still, it seems to be a fixable bug, and not a limitation in the language itself. I have no ETA, unfortunately, but perhaps we could lay low with this for a while until we know? I would prefer keeping our current, broken way of doing things over changing everything everywhere and then doing it all over again because the bug was fixed a few days or weeks later. |
Once more to the original issue: Transforms can only be applied to |
I am still not convinced of the benefit of introducing yet another cover. Why would we need |
If you don't think we need it, okay, fine. |
I agree. We can have a property in box: |
Accidentally pressed close...sorry. |
Ok. My thoughts I have written here. I will exit this discussion now. |
This is what I think:
And in the context of the
|
I need |
I'll take care of |
This is how we will make the changes:
@emilwestergren is doing the first one. Who wants to continue? |
What's left to do in terms of "Ensure right use of Vector and Point everywhere."? |
Since it is hard to know when it is finished, this issue is probably not very useful anymore. If we find places where it should be changed, we can open new issues. I suggest closing this. |
Agreed. An issue like "Do X wherever needed" doesn't quite fit our definition of a github issue. |
I was thinking about translation it |
Use
size
for translations not points. For example inFloatEuclidTransform
. See https://github.com/cogneco/ooc-kean/pull/662 for details.The text was updated successfully, but these errors were encountered: