When I ported a game from Pharo to Amber, I lacked some features that I had to reimplement on my side. I'm merging back to upstream everything I can in this PR.
Every method I added has a sunit test associated.
A lot of methods are heavily inspired by Pharo, it's often the exact same implementation. I don't know if I did well or not because it's copy-pasting... Now I don't think Pharo license forbids it, and most of these implementations are straightforward, so...
Here is the list of methods I added:
Number
min:max:
degreesToRadians
radiansToDegrees
arcTan:
between:and:
Number class
radiansPerDegree (a constant for conversion)
Point
dotProduct:
normal
angle
normalized
r
corner:
extent:
rectangle:
Rectangle (new class)
corner
origin
containsPoint:
containsRect:
printOn:
Rectangle class
origin:corner:
origin:extent:
point:point:
When I ported a game from Pharo to Amber, I lacked some features that I had to reimplement on my side. I'm merging back to upstream everything I can in this PR.
Every method I added has a sunit test associated.
A lot of methods are heavily inspired by Pharo, it's often the exact same implementation. I don't know if I did well or not because it's copy-pasting... Now I don't think Pharo license forbids it, and most of these implementations are straightforward, so...
Here is the list of methods I added:
* Number
+ min:max:
+ degreesToRadians
+ radiansToDegrees
+ arcTan:
+ between:and:
* Number class
+ radiansPerDegree (a constant for conversion)
* Point
+ dotProduct:
+ normal
+ angle
+ normalized
+ r
+ corner:
+ extent:
+ rectangle:
* Rectangle (new class)
+ corner
+ origin
+ containsPoint:
+ containsRect:
+ printOn:
* Rectangle class
+ origin:corner:
+ origin:extent:
+ point:point:
Re Pharo copy-pasting: Pharo is reference implementation for Amber, there is lot of other who are copypasted from Pharo as well, it is basically the default way to add something (look if Pharo has it and take it).
Re Pharo copy-pasting: Pharo is reference implementation for Amber, there is lot of other who are copypasted from Pharo as well, it is basically the default way to add something (look if Pharo has it and take it).
You have broken the formatting (your functions were without the space, while ones I got from recompiling do have one).
How did you manage to do that / could you prevent it in the future (I don't know what could cause that, maybe you are using old Amber)?
You have broken the formatting (your functions were without the space, while ones I got from recompiling do have one).
How did you manage to do that / could you prevent it in the future (I don't know what could cause that, maybe you are using old Amber)?
Duh, sorry about that. It must be because I'm using the amber-cli from node... When I write amber -v it says Welcome to Amber CLI version 0.101.0 (Amber 0.18.5, NodeJS 6.11.0).. I tried to update it but apparently it's the last version. Am I supposed to directly use some command in the git repository?
Duh, sorry about that. It must be because I'm using the amber-cli from node... When I write `amber -v` it says `Welcome to Amber CLI version 0.101.0 (Amber 0.18.5, NodeJS 6.11.0).`. I tried to update it but apparently it's the last version. Am I supposed to directly use some command in the git repository?
Mine shows the same (except different node version). But that should not matter at all. CLI is not using its internal Amber, it uses project's one.
This is actually strange, b/c the methods were definitely compiled by 0.19.0 compiler (hacing both self and $self in compiled .js), and the only instances of 'wrong' formatting was in the added methods, but not in ones there were there already.
Anyway, I do not use cli unless needed (which is only in edge cases when upgrading code format). But regardless, cli produces the same format as IDE. It is really mysterious to me how come your commits actually had those functions you added without space after fn: function piece...
Mine shows the same (except different node version). But that should not matter at all. CLI is not using its internal Amber, it uses project's one.
This is actually strange, b/c the methods were definitely compiled by 0.19.0 compiler (hacing both `self` and `$self` in compiled .js), and the only instances of 'wrong' formatting was in the added methods, but not in ones there were there already.
Anyway, I do not use cli unless needed (which is only in edge cases when upgrading code format). But regardless, cli produces the same format as IDE. It is really mysterious to me how come your commits actually had those functions you added without space after `fn: function` piece...
Anyway, should you want to be sure, running Compiler recompileAll and then committing the package(s) you worked on and reloading; or running grunt from CLI, should recompile things (the former is better as it saves both .st and .js files in normalized format, the latter only produces .js from .st). Then, git diffing is your friend to see if something was messed up or everythihg is ok.
Anyway, should you want to be sure, running `Compiler recompileAll` and then committing the package(s) you worked on and reloading; or running `grunt` from CLI, should recompile things (the former is better as it saves both .st and .js files in normalized format, the latter only produces .js from .st). Then, git diffing is your friend to see if something was messed up or everythihg is ok.
Strange thing is it should actually not be needed. It just compiles every method again, they should be correct when compiled the first time.
I really don't know what happened that only the new methods were different.
It's actually a mystery of a kind.
I tend to do it mainly as a test to see if I did not touch something when I do changes to deep Amber, like to the compiler.
But, yeah, it's good to have it in the toolset.
Strange thing is it should actually not be needed. It just compiles every method again, they should be correct when compiled the first time.
I really don't know what happened that only the new methods were different.
It's actually a mystery of a kind.
I tend to do it mainly as a test to see if I did not touch something when I do changes to deep Amber, like to the compiler.
But, yeah, it's good to have it in the toolset.
When I ported a game from Pharo to Amber, I lacked some features that I had to reimplement on my side. I'm merging back to upstream everything I can in this PR.
Every method I added has a sunit test associated.
A lot of methods are heavily inspired by Pharo, it's often the exact same implementation. I don't know if I did well or not because it's copy-pasting... Now I don't think Pharo license forbids it, and most of these implementations are straightforward, so...
Here is the list of methods I added:
Number
Number class
Point
Rectangle (new class)
Rectangle class
Also include the API in API-CHANGES, pls.
Re Pharo copy-pasting: Pharo is reference implementation for Amber, there is lot of other who are copypasted from Pharo as well, it is basically the default way to add something (look if Pharo has it and take it).
API-CHANGES updated
You have broken the formatting (your functions were without the space, while ones I got from recompiling do have one).
How did you manage to do that / could you prevent it in the future (I don't know what could cause that, maybe you are using old Amber)?
Duh, sorry about that. It must be because I'm using the amber-cli from node... When I write
amber -v
it saysWelcome to Amber CLI version 0.101.0 (Amber 0.18.5, NodeJS 6.11.0).
. I tried to update it but apparently it's the last version. Am I supposed to directly use some command in the git repository?I may have missed the last step of the contributing guide that says to run
grunt
before starting to dev...Mine shows the same (except different node version). But that should not matter at all. CLI is not using its internal Amber, it uses project's one.
This is actually strange, b/c the methods were definitely compiled by 0.19.0 compiler (hacing both
self
and$self
in compiled .js), and the only instances of 'wrong' formatting was in the added methods, but not in ones there were there already.Anyway, I do not use cli unless needed (which is only in edge cases when upgrading code format). But regardless, cli produces the same format as IDE. It is really mysterious to me how come your commits actually had those functions you added without space after
fn: function
piece...Anyway, should you want to be sure, running
Compiler recompileAll
and then committing the package(s) you worked on and reloading; or runninggrunt
from CLI, should recompile things (the former is better as it saves both .st and .js files in normalized format, the latter only produces .js from .st). Then, git diffing is your friend to see if something was messed up or everythihg is ok.Thanks for the explanation, I will be sure to recompile next time
Strange thing is it should actually not be needed. It just compiles every method again, they should be correct when compiled the first time. I really don't know what happened that only the new methods were different. It's actually a mystery of a kind.
I tend to do it mainly as a test to see if I did not touch something when I do changes to deep Amber, like to the compiler.
But, yeah, it's good to have it in the toolset.
@stevenremot Pls add yourself to the CONTRIBUTORS file in another PR. Thanks.
Got it! I may not be able to do it before a few weeks but I keep it in my todo list