Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 22:45
    straight-shoota milestoned #11229
  • 22:43
    straight-shoota demilestoned #11343
  • 19:54
    Blacksmoke16 labeled #11549
  • 19:47
    kalinon labeled #11549
  • 19:47
    kalinon opened #11549
  • 18:14
    straight-shoota labeled #11532
  • 18:13
    straight-shoota edited #11532
  • 18:11
    straight-shoota synchronize #11532
  • 17:58
    straight-shoota milestoned #11545
  • 17:58
    straight-shoota milestoned #11379
  • 17:56
    neatorobito synchronize #11543
  • 17:22
    oprypin milestoned #11534
  • 16:18
    straight-shoota edited #11177
  • 16:17
    straight-shoota milestoned #11475
  • 15:06
    straight-shoota review_requested #11475
  • 15:04
    straight-shoota synchronize #11475
  • 15:03
    straight-shoota synchronize #11475
  • 14:01
    straight-shoota closed #11523
  • 13:35
    straight-shoota demilestoned #11515
  • 13:24
    beta-ziliani unlabeled #11529
mfiano
@mjfiano:matrix.org
[m]
So would you say that you recommend explicitly listing every file and very rarely use the glob except for collections of order independent submodules?
George Dietrich
@Blacksmoke16
pretty much yea
mfiano
@mjfiano:matrix.org
[m]
I have always preferred to do a serial load order myself in Lisp, manually toposorting it as I develop so that sounds like what I prefer
George Dietrich
@Blacksmoke16
however you do it, just need to ensure things are required before they're used, that's the key point
having every file require everything it needs is a bit overkill
mfiano
@mjfiano:matrix.org
[m]
Maybe doing it that way will solve a lot of my problems. The setup that has been giving me grief is a main file doing require "./origin/*, and then trying to get the requires right in that directory. That sounds like a recipe for failure now that I actually typed it out 😆
George Dietrich
@Blacksmoke16
totally could still use the glob, but require the common things before
mfiano
@mjfiano:matrix.org
[m]
True, I haven't come up with a hierarchy I like yet (only a handful of files)
So mostly working with a flat directory
George Dietrich
@Blacksmoke16
is suggested to group things by namespace
i.e. exceptions live in Athena::Routing::Exceptions namespace
etc
mfiano
@mjfiano:matrix.org
[m]
and that maps to src/athena/routing/exceptions/?
George Dietrich
@Blacksmoke16
technically src/exceptions
i dont use that extra directory, but otherwise would be like src/athena/exceptions
i guess i kinda use the org/repo name as the first two components to that
mfiano
@mjfiano:matrix.org
[m]
Ok, well it works explicitly listing each file in toposorted order. I'll work on organizing by concept next.
Unrelated:
What is an easy way to test the expansion of a macro you're in the process of writing? The crystal vim plugin has a function for this but it is bugged half the time. So I guess, what is the builtin way, and is there any 3rd party improvement, or utilities for writing macros in general?
George Dietrich
@Blacksmoke16
wouldn't that just be testing the functionality it generates?
dont really need to test the macro part of it specifically
mfiano
@mjfiano:matrix.org
[m]
I would like to see the generated code is what it is supposed to be before testing functionality. I've caught subtle errors that way in my years of macro writing.
George Dietrich
@Blacksmoke16
ohh i see
add a {{debug}} to the end of the macro
mfiano
@mjfiano:matrix.org
[m]
I see. Not sure how I missed that in the api docs. Would have been nice when I wrote the macros earlier.
Very nice
Are there any common general utility libraries for Crystal?
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]