Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 04:54
    aarongodin synchronize #11765
  • 04:52
    aarongodin synchronize #11765
  • 04:42
    aarongodin synchronize #11765
  • Jan 24 18:25
    straight-shoota labeled #11765
  • Jan 24 18:25
    straight-shoota labeled #11765
  • Jan 24 18:20
    FnControlOption synchronize #11476
  • Jan 24 18:06
    aarongodin opened #11765
  • Jan 24 17:42
    straight-shoota synchronize #11563
  • Jan 24 17:39
    FnControlOption synchronize #11476
  • Jan 24 17:05
    asterite closed #11756
  • Jan 24 14:30
    straight-shoota synchronize #11563
  • Jan 23 16:04
    HertzDevil labeled #11764
  • Jan 23 16:04
    HertzDevil opened #11764
  • Jan 23 16:04
    HertzDevil labeled #11764
  • Jan 23 15:34
    HertzDevil labeled #11763
  • Jan 23 15:34
    HertzDevil labeled #11763
  • Jan 23 15:34
    HertzDevil opened #11763
  • Jan 23 15:20
    HertzDevil labeled #11761
  • Jan 23 15:10
    HertzDevil labeled #11762
  • Jan 23 15:10
    HertzDevil labeled #11762
George Dietrich
@Blacksmoke16
and like crystal env
mfiano
@mjfiano:matrix.org
[m]

https://i.lisp.cl/iMWLBA.png

This is what I see when I save that file

1.0.0
George Dietrich
@Blacksmoke16
ohh, let me make that not a macro now
mfiano
@mjfiano:matrix.org
[m]
CRYSTAL_CACHE_DIR=/home/mfiano/.cache/crystal
CRYSTAL_PATH=lib:/usr/lib/crystal
CRYSTAL_VERSION=1.0.0
CRYSTAL_LIBRARY_PATH=''
CRYSTAL_OPTS=''
George Dietrich
@Blacksmoke16
ah ok
i kno why
no nvm
mfiano
@mjfiano:matrix.org
[m]
can you even repro?
George Dietrich
@Blacksmoke16
yea i get Error: undefined method 'rand' for Origin::Vector2.class
mfiano
@mjfiano:matrix.org
[m]
Good, it's not just me
George Dietrich
@Blacksmoke16
i think i see the problem tho
mfiano
@mjfiano:matrix.org
[m]
So yeah, if you can figure out why the macro hook makes it work, i might be able to figure out why i get tons of these similar problems
George Dietrich
@Blacksmoke16
by including Origin::Shared that triggers the macro included hook which extends the class methods on Origin::Vector, but by wrapping that in another macro included makes it not expand until Origin::Vector is included in the actual Vector* types
mfiano
@mjfiano:matrix.org
[m]
I think my mind just imploded
George Dietrich
@Blacksmoke16
i'd argue maybe modules aren't the best solution here versus some parent structs?
mfiano
@mjfiano:matrix.org
[m]
Well inheritance graph is going to get hairy...i have a lot to add
I'd rather use mixins if possible
George Dietrich
@Blacksmoke16
but if the mixins are included in every type, doesnt that defeat the purpose?
basically recreating the same structure, but in a diff way
mfiano
@mjfiano:matrix.org
[m]
So I guess the 2 solutions I see are
1) Copy the include Origin::Shared into each concrete type instead of once in the Vector mixin.
2) I already forgot because I'm tired :(
Well right now, yes it does defeat the purpose. It might get a little hard to model with inheritance later on
Shared is intended to be stuff common to all base math types (vectors, matrices, and quaternions). Vector is stuff common to all vectors (but Vector3 is special and will define more stuff for itself), and then there will be higher order math types making use of these 3 base types or varying dimensions
It's a rather large project, about 20kloc of Lisp
George Dietrich
@Blacksmoke16
even if you have methods defined on parent types, you can override them
but fair enough
mfiano
@mjfiano:matrix.org
[m]
I suppose I could try inheritance tomorrow if you think it is a better fit
Really, I'm used to functional programming and a very different kind of OOP (methods not associated with classes at all with multiple dispatch)
So this way of coding is very new to me
George Dietrich
@Blacksmoke16
idk what other stuff you have to do, but atm it seems like it might be better
mfiano
@mjfiano:matrix.org
[m]
That's good enough for me. Thanks for taking a peek
Wait, Crystal is single inheritance right?
George Dietrich
@Blacksmoke16
yes
mfiano
@mjfiano:matrix.org
[m]
This may be difficult already then...but I'll think about it tomorrow
George Dietrich
@Blacksmoke16
:grimacing: worth looking into at least
mfiano
@mjfiano:matrix.org
[m]
Are class/struct-level constants inherited?
George Dietrich
@Blacksmoke16
mfiano
@mjfiano:matrix.org
[m]
Ok that's one thing over mixins then
mfiano
@mjfiano:matrix.org
[m]
If I have a macro method on an abstract struct, will it be inherited by children such that the @type is expanded for the concrete struct?
George Dietrich
@Blacksmoke16
If you put it in a macro inherited probably
mfiano
@mjfiano:matrix.org
[m]
Ok.

Probably not, but is there an existing library for outputting tabulated numbers, particularly floats? I would like to define an #inspect method for 4x4 matrices so it looks like:

0.123 0.484824 12.434934 93.32459
10.4944 0.43244 343.3434 434.0
23.2384 29.34242 93.22424 0.12525
0.2435 0.533556789 0.645532 0.2434534

except:
1) padding should be auto-inserted such that the whitespace around each column is aligned
2) padding should be auto-inserted such that the decimal points in a column are all aligned.

George Dietrich
@Blacksmoke16
dunno if its possible with it, but might be best bet with stdlib
mfiano
@mjfiano:matrix.org
[m]
Hmm ok
mfiano
@mjfiano:matrix.org
[m]
tablo looks very close to what I want. I would definitely need it to work for 1D StaticArray's though which it doesn't support...wonder if I can overload something.
George Dietrich
@Blacksmoke16
doesnt support how?
mfiano
@mjfiano:matrix.org
[m]
docs mention it supporting only Array type, and 2D
George Dietrich
@Blacksmoke16
could call .to_a on it
ofc that would allocate memory and stuff tho but might not be terrible just for UI output like that :shrug: