Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 06:23
    matthewmcgarvey labeled #12831
  • 06:23
    matthewmcgarvey opened #12831
  • 00:44
    straight-shoota unlabeled #11647
  • 00:43
    straight-shoota milestoned #11647
  • 00:43
    straight-shoota milestoned #11647
  • 00:24
    straight-shoota assigned #12534
  • Dec 09 18:24
    Blacksmoke16 labeled #12830
  • Dec 09 18:16
    FnControlOption labeled #12830
  • Dec 09 18:16
    FnControlOption opened #12830
  • Dec 09 14:39
    Blacksmoke16 synchronize #10648
  • Dec 09 12:23
    straight-shoota assigned #12740
  • Dec 09 12:23
    straight-shoota synchronize #12740
  • Dec 09 11:28
    straight-shoota closed #11409
  • Dec 09 11:28
    straight-shoota labeled #11409
  • Dec 09 11:28
    straight-shoota labeled #11409
  • Dec 09 11:25
    straight-shoota labeled #12829
  • Dec 09 11:25
    straight-shoota labeled #12829
  • Dec 09 11:25
    straight-shoota closed #7532
  • Dec 09 11:24
    straight-shoota labeled #7532
  • Dec 09 11:24
    straight-shoota labeled #7532
mfiano
@mjfiano:matrix.org
[m]
It is unrelated to any of the aggregate types...it defines some functions for Float64 elements themselves
George Dietrich
@Blacksmoke16
if they're unrelated put em in a Utility namespace?
mfiano
@mjfiano:matrix.org
[m]
I could, but how would I make it private to users...they're sort of just an implementation detail of some of the aggregate types' methods
George Dietrich
@Blacksmoke16
nodoc it
wouldnt show up anywhere since you're not including/extending anything
mfiano
@mjfiano:matrix.org
[m]
Sold
George Dietrich
@Blacksmoke16
not sure im a fan of the =~ method name tho for a class method
mfiano
@mjfiano:matrix.org
[m]
For a class name?
oh
I cannot read
George Dietrich
@Blacksmoke16
works better when its between instances, but a more english name might be better
mfiano
@mjfiano:matrix.org
[m]
That was suggested in this chat quite a few days ago by someone, because 99% of use cases are going to be in the form of a binary operator, not the method call syntax...and can only use a whitelisted set of symbols there
I'm not sold on it either, but
Origin::Vector3.nearly_equal? v1, v2 user code calling Origin::Util.nearly_equal? f1, f2, rel_tol, abs_tol internal code isn't too bad I suppose
George Dietrich
@Blacksmoke16
wait
why not v1 =~ v2
or is that how it was?
mfiano
@mjfiano:matrix.org
[m]
You just said you didn't like that, and neither do I tbh
Or did I misunderstand?
George Dietrich
@Blacksmoke16
it looked like it was used as Origin::Scalar.=~ v1, v2
due to the extend self
mfiano
@mjfiano:matrix.org
[m]
It is internally, because you cannot use the method call notation without a module prefix
The extend self was needed too
George Dietrich
@Blacksmoke16
id still use nearly_equal? but have def =~ instance method use that internally
id also look into def ===
which is used for case equality, which could forward to =~
mfiano
@mjfiano:matrix.org
[m]
This topic is both complicated and subjective. I left something out.
You pretty much never want to use == on two floats, let alone 2 aggregates of floats, so == calls out to =~ incase the user didn't use the more explicit approximation method, which would clearly be an error. The problem is, == must take exactly 1 receiver and 1 argument, so the defaults for rel_tol and abs_tol must be used in that case.
Which is also an error, albeit a lesser one
So there is no good solution that I know of
mfiano
@mjfiano:matrix.org
[m]
The reason for using the =~ symbol over == to begin with is because of this...the parser treats all = suffixed method names as setters, and errors on arity overloading away from that.
I think we discussed this already though :)
George Dietrich
@Blacksmoke16
yea, i figured it was because =~ represents matches
mfiano
@mjfiano:matrix.org
[m]
I personally don't think an operator should be used for a variadic function, and also because =~ doesn't mean the usual to Crystal programmers.
So I will more than likely move to nearly_equals?
George Dietrich
@Blacksmoke16
:thumbsup:
mfiano
@mjfiano:matrix.org
[m]
I might even go as far as to def ==; {{ raise ... }; end for vector types.
err with an other in there somewhere :)
mfiano
@mjfiano:matrix.org
[m]
Hmm, so with inheritance those pesky class methods are giving me issues again
George Dietrich
@Blacksmoke16
Oh?
mfiano
@mjfiano:matrix.org
[m]
It's saying that a .new method with 2 arguments doesn't exist when calling .rand...but i can call .new manually with 2 args...i haven't quite figured it out yet...
George Dietrich
@Blacksmoke16
Can you push up an example
mfiano
@mjfiano:matrix.org
[m]
done
Shoved everything in 1 file for now, sorry if it's hard to read like that
mfiano
@mjfiano:matrix.org
[m]
I bet those constants are eagerly evaluated before inheritance
I dunno though
George Dietrich
@Blacksmoke16
is the idea that they're a singleton?
mfiano
@mjfiano:matrix.org
[m]
what is they?
George Dietrich
@Blacksmoke16
i mean if those constants are just meant to an easy way to get that type in a specific state just do like