Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 02:52
    ftarulla edited #12068
  • 02:51
    ftarulla opened #12069
  • 02:11
    ftarulla synchronize #12068
  • 00:03
    Blacksmoke16 labeled #12068
  • 00:03
    Blacksmoke16 labeled #12068
  • May 24 23:25
    ftarulla edited #12068
  • May 24 23:24
    ftarulla opened #12068
  • May 24 12:34
    straight-shoota labeled #12067
  • May 24 12:34
    straight-shoota labeled #12067
  • May 24 12:33
    straight-shoota milestoned #12067
  • May 24 09:17
    lbguilherme synchronize #10768
  • May 23 19:35
    lbguilherme synchronize #10768
  • May 23 19:06
    lbguilherme synchronize #10768
  • May 23 18:47
    lbguilherme synchronize #10768
  • May 23 18:46
    lbguilherme synchronize #10768
  • May 23 13:02
    Blacksmoke16 labeled #12066
  • May 23 13:02
    Blacksmoke16 labeled #12066
  • May 23 11:16
    lbguilherme opened #12067
  • May 23 07:58
    mig-hub labeled #12066
  • May 23 07:58
    mig-hub opened #12066
mfiano
@mjfiano:matrix.org
[m]
Things that got rejected for the stdlib, or things useful for everyday programming that didn't make it into the language yet for some reason or other?
George Dietrich
@Blacksmoke16
Like what?
There are some, but depends on what you are doing exactly
I'd definitely suggest using https://github.com/crystal-ameba/ameba tho
mfiano
@mjfiano:matrix.org
[m]
I have that and debug.cr so far. I meant like general purpose utilities. Lisp has "alexandria", which includes necessities like correct macro writing macros such as once_only I discussed before, pattern matching stuff, etc etc
George Dietrich
@Blacksmoke16
Can't say I've heard of debug.cr. I also use Athena's spec component sometimes, but other than that nothing comes to mind stdlib usually has everything I need.
mfiano
@mjfiano:matrix.org
[m]
debug.cr is basically pp! but with color, line numbers, etc, and can use in the middle of expressions
George Dietrich
@Blacksmoke16
Fair enough
mfiano
@mjfiano:matrix.org
[m]
Ok so
In my main src/origin.cr file I have this and only this:
require "./origin/scalar"
require "./origin/shared"
require "./origin/vector"
In vector.cr it starts out like this:
module Origin::Vector(T)
  forward_missing_to @data

  include Origin::Shared(Float64) # Error: undefined constant Origin::Shared

  ...
end
The include compiles if I put it in a macro included though
These are the errors that drive me crazy because I don't see where they are coming from.
I only have 3 files, and this is the last file parsed
shared.cr should have already been loaded and the module defined...
George Dietrich
@Blacksmoke16
Do you have this all pushed up atm?
mfiano
@mjfiano:matrix.org
[m]
No but I could
Give me a minute
mfiano
@mjfiano:matrix.org
[m]
Hey Mr. Grant, my stalker :)
George Dietrich
@Blacksmoke16
what were you running to get that?
mfiano
@mjfiano:matrix.org
[m]
I didn't think to run that, because the semantic analyzer in nim showed the aforementioned error in my buffer upon saving
s/vim/vim/
err nim -> vim. must be almost that time :/
The test code I have under those 3 requires is:
alias V2 = Origin::Vector2
x = V2.new(2.0, 8.123)
pp! x + x
pp! x == V2.new(2.0, 8.123_001)
pp! V2.rand(V2::ZERO, V2::ONES)
pp! V2.rand
pp! V2::ZERO.zero?
pp! x.clamp
pp! x.same_direction?(x)
pp! V2::LEFT
George Dietrich
@Blacksmoke16
thz
worked fine for me?
mfiano
@mjfiano:matrix.org
[m]
:/
George Dietrich
@Blacksmoke16
sure you dont have anything else going on?
mfiano
@mjfiano:matrix.org
[m]
I'm positive. everything else is checked in
George Dietrich
@Blacksmoke16
what's crystal --version say?
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