jhass changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Crystal 0.35.1 | Fund Crystal's development: https://crystal-lang.org/sponsors | GH: https://github.com/crystal-lang/crystal | Docs: https://crystal-lang.org/docs | Gitter: https://gitter.im/crystal-lang/crystal
<FromGitter> <3n-k1> @Blacksmoke16 that only transforms incoming requests, not outgoing responses
<FromGitter> <3n-k1> at least, from what i saw browsing the handler code
<FromGitter> <Blacksmoke16> i mean could you not have a middleware that does like
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5fb46694c6fe0131d4004368]
<FromGitter> <3n-k1> i don't think handlers can return a response tho
<FromGitter> <Blacksmoke16> no, but they an override the io of the response, then alter that, then write to the actual io?
<FromGitter> <Blacksmoke16> :shrug:
<FromGitter> <3n-k1> how would you override the io tho?
<FromGitter> <3n-k1> also that just seems incredibly hacky lol
<FromGitter> <Blacksmoke16> something like that
<FromGitter> <3n-k1> huh
<FromGitter> <Blacksmoke16> i mean how else would you do it? In kemal land there isnt an abstraction around the response, so if the user does like `ctx.response << "foo"` the client has already been sent that data
<FromGitter> <3n-k1> that could totally work
<FromGitter> <3n-k1> well django has middleware hooks for when certain parts of the response throw an exception
<FromGitter> <3n-k1> that's how i was thinking about it
<FromGitter> <Blacksmoke16> as does Athena 😉
<FromGitter> <3n-k1> athena does things in a way i don't like and i refuse to change, even if those changes are better!
<FromGitter> <3n-k1> :p
<FromGitter> <Blacksmoke16> hehe, it also maps exceptions to http errors, like you suggested in your issue
<FromGitter> <3n-k1> oh no, i actaully really like athena
<FromGitter> <3n-k1> nooo time to rewrite this entire application lol
<FromGitter> <Blacksmoke16> boo :P maybe it would get simpler ha
<FromGitter> <3n-k1> yeah. i'm not too far in, i think rewriting is for the best
<FromGitter> <Blacksmoke16> but yea, kemal doesnt have some of those abstractions. And given the current state of it i wouldnt get my hopes too high
<FromGitter> <3n-k1> spent most of the day planning out a forms/validation system, but i think athena would be a lot less work lol
<FromGitter> <Blacksmoke16> doing server rendered HTML i assume? or REST?
<FromGitter> <3n-k1> literally just browsing your routing docs and this looks exactly like what i want
<FromGitter> <3n-k1> most likely a static frontend to a crud db with authentication
<FromGitter> <3n-k1> for now, at least
<FromGitter> <3n-k1> i mean, my routes are literally just returning static heredocs lol
<FromGitter> <Blacksmoke16> ❤️ good to hear ha
<FromGitter> <Blacksmoke16> could prob use like nginx or something if its just static no?
<FromGitter> <3n-k1> does athena have something like django's `reverse` function, where you give it a name and it returns a url?
<FromGitter> <3n-k1> i could but i have no idea how to use nginx
<FromGitter> <3n-k1> and it's technically only *mostly* static
<FromGitter> <Blacksmoke16> fair enough, would be more performant tho
<FromGitter> <Blacksmoke16> yea fair enough
<FromGitter> <Blacksmoke16> and not atm, but some work that im thinking thru now would allow for that i think
Elouin has quit [Read error: Connection reset by peer]
<FromGitter> <Blacksmoke16> i assume thats for like generating links in the html?
Elouin has joined #crystal-lang
<raz> pro-tip: nginx is for old people. caddy is where it's at.
<FromGitter> <incognitorobito> ^
<FromGitter> <Blacksmoke16> so iv'e heard :p
<oprypin> caddy is for college students then or what
<FromGitter> <incognitorobito> :p maybe
<FromGitter> <Blacksmoke16> then what about apache :p
<FromGitter> <3n-k1> apache is all i know and my god do i hate it
<FromGitter> <3n-k1> when you thought xml was too simple so you extend it and make it worse
<FromGitter> <3n-k1> > i assume thats for like generating links in the html? ⏎ whoops i missed your response, sorry! it's mostly for generating html, but also for redirecting to other urls. it's mainly used for reusable apps, but i really like the ability to change my entire url schema just by changing one thing in the urlconf
<FromGitter> <3n-k1> that's why i was asking about macro hashmaps yesterday lol
<FromGitter> <Blacksmoke16> based on what i read my understanding is if you have a route like `/user/:id` thats in a `UserController` you can do like `reverse('UserController:get_user', args: {"id" => 10})` and it return `/user/10` yea?
<FromGitter> <Blacksmoke16> yea, think im trying to figure out now would enable that
<FromGitter> <Blacksmoke16> thing*
<FromGitter> <ImAHopelessDev_gitlab> just use php, duh /s
<FromGitter> <3n-k1> @Blacksmoke16 yeah, something like that. in django, you define `path('user<pk>/', user_view, name='user_view')` and then you can call `reverse('user_view', pk=10)` and get back `/user/10`
<FromGitter> <Blacksmoke16> 👍 perfect
<FromGitter> <3n-k1> so yes, literally exactly what you wrote lol. django uses some centralized url configuration variables though, i'm not sure if you'd be able to get that with a macro?
<FromGitter> <Blacksmoke16> plan atm is to abstract some logic into a new `Router` singleton type that knows about all the routes and stuff
<FromGitter> <3n-k1> awesome! let me know if you need any help/extra info :)
<FromGitter> <Blacksmoke16> will do
<FromGitter> <Blacksmoke16> any other ideas/suggestions, or any questions etc you have feel free to join the Athena gitter ch
<FromGitter> <3n-k1> what's the gitter? i can't find it lol
deavmi has quit [Ping timeout: 272 seconds]
kotrcka has joined #crystal-lang
<FromGitter> <3n-k1> ty ty
deavmi has joined #crystal-lang
Human_G33k has quit [Remote host closed the connection]
Human_G33k has joined #crystal-lang
Human_G33k has quit [Max SendQ exceeded]
Human_G33k has joined #crystal-lang
f1refly has joined #crystal-lang
f1reflyylmao has quit [Ping timeout: 260 seconds]
<FromGitter> <YusufCakan> Hi, how long does it take to run the compiler specs. My computer seems to take about 30 mins. Is this normal
<FromGitter> <Blacksmoke16> Sounds about right
<FromGitter> <Blacksmoke16> Could just run the spec you changed versus them all tho
<FromGitter> <3n-k1> yeah, it takes me about 30 minutes as well
sorcus has quit [Ping timeout: 260 seconds]
<FromGitter> <YusufCakan> Thanks
sorcus has joined #crystal-lang
avane has quit [Quit: ZNC - https://znc.in]
avane has joined #crystal-lang
chachasmooth has quit [Ping timeout: 264 seconds]
kotrcka has quit [Quit: Konversation terminated!]
chachasmooth has joined #crystal-lang
Vexatos has quit [Quit: ZNC Quit]
<FromGitter> <3n-k1> is there a non-blocking `#receive` for Channel?
<FromGitter> <3n-k1> i have discovered the select statement
Elouin has left #crystal-lang ["So long and thanks for all the fish!"]
<FromGitter> <3n-k1> i've got this code, but it keeps crashing because it runs out of file descriptors. the Dir is never getting closed, and it looks like it isn't even getting garbage collected? ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ to the file, and the destructor never gets called. things work if i use a temp variable for `Dir.new`, but not without it' [https://gitter.im/crystal-lang/crystal?at=5fb4c3112a60f731f760d511]
<FromGitter> <3n-k1> is that a bug, or did i just do a bad?
<FromGitter> <3n-k1> if i use the `Dir.each_child` class method it also works fine
<FromGitter> <HertzDevil> use `Dir.open` instead
<FromGitter> <HertzDevil> that's what `.each_child` does too:
<FromGitter> <HertzDevil> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5fb4c512bf955735eb87fb72]
<FromGitter> <3n-k1> docs say that `.open` is an alias for `.new`
<FromGitter> <HertzDevil> the non-block form is an alias, the block form isn't
<FromGitter> <3n-k1> ah
<FromGitter> <3n-k1> ty
ua_ has joined #crystal-lang
ua has quit [Ping timeout: 264 seconds]
Vexatos has joined #crystal-lang
<FromGitter> <ImAHopelessDev_gitlab> what's & : String -> doing
<FromGitter> <ImAHopelessDev_gitlab> i don't think i've seen & : Type before
<FromGitter> <naqvis> hi Girng
<FromGitter> <naqvis> `&` is block argument and `->` is syntactic sugar for `Proc`
<FromGitter> <naqvis> you can combine both together, assume you have a `Proc` and you want to pass that to a method, which is expecting block, then you can do `&->......`
<FromGitter> <ImAHopelessDev_gitlab> oh i see, never used Procs before. Ty
<FromGitter> <naqvis> ywc
<FromGitter> <naqvis> you can read Blocks and Procs section (https://crystal-lang.org/reference/syntax_and_semantics/blocks_and_procs.html)
<FromGitter> <ImAHopelessDev_gitlab> @naqvis 👍👍
_whitelogger has joined #crystal-lang
<FromGitter> <anthonyshull> i am very new to crystal and have have some questions about how to structure a program
<FromGitter> <anthonyshull> i'm wanting to have a client that takes configuration and injects that into a service provider
<FromGitter> <anthonyshull> are modules the best way to go?
<FromGitter> <Blacksmoke16> sounds like a struct to store the config and a class method `self.from_config` that configures the provider with the config?
<FromGitter> <Blacksmoke16> some example code would help here
<FromGitter> <anthonyshull> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5fb5276274152347c240a55f]
<FromGitter> <anthonyshull> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5fb5279ebf955735eb88fd2d]
<FromGitter> <anthonyshull> that does give me access to api_key, etc.
<FromGitter> <anthonyshull> though, it's a little magical since api_key obviously doesn't exist in the services file
<FromGitter> <Blacksmoke16> are you using those `queryAddress` methods elsewhere? or only in the client type?
<FromGitter> <anthonyshull> just on the client
<FromGitter> <Blacksmoke16> then why use the module versus just including them directly in the client?
<FromGitter> <anthonyshull> because there are going to be tons of services
<FromGitter> <Blacksmoke16> could always have an abstract client type then child types for more specialized clients
<FromGitter> <anthonyshull> yeah, that's what i did in the php version
<FromGitter> <Blacksmoke16> that'd make sense here as well. Modules are like PHP traits
<FromGitter> <anthonyshull> yeah, what i really want is to have both
<FromGitter> <Blacksmoke16> oh?
<FromGitter> <anthonyshull> ```shipengine.queryAddress(address) ⏎ ShipEngine::Services:Address.queryAddress(address)``` [https://gitter.im/crystal-lang/crystal?at=5fb52890b86f6407045b4aa9]
<FromGitter> <anthonyshull> or even just ... `::Address.query(address)`
<FromGitter> <Blacksmoke16> hmm
<FromGitter> <anthonyshull> not sure if that is possible or necessary
<FromGitter> <anthonyshull> i'm thinking it is some kind of combination of modules and an abstract service factory
<FromGitter> <anthonyshull> where the services provide a lower level of control and the modules provide convenience methods
<FromGitter> <anthonyshull> is it idiomatic to put a module and a class in the same file?
<FromGitter> <anthonyshull> like in address.cr i could have both:
<FromGitter> <anthonyshull> also, they have a require at the bottom of the file, is that normal? i'm guessing so they have access to the Strip.client in other files
<FromGitter> <tenebrousedge> it's not normal
<FromGitter> <tenebrousedge> but maybe something else is overriding that class later?
<FromGitter> <Blacksmoke16> i mean you could have class methods on the classes that new up a client and do the request and return the data
<FromGitter> <Blacksmoke16> `HTTP::Client` does something similar
<FromGitter> <Blacksmoke16> but id maybe keep things simple for now and can always iterate
<FromGitter> <Blacksmoke16> build a good foundation then go from there
<FromGitter> <tenebrousedge> that lib doesn't have a version file
<FromGitter> <tenebrousedge> so I suppose it's declaring the class there so that they can use the short syntax without Crystal thinking that `Stripe` is a module
<FromGitter> <tenebrousedge> I don't think I get the class variables
<FromGitter> <tenebrousedge> but w/e
<FromGitter> <Blacksmoke16> prob are assuming they keys are the same globally
chloekek has joined #crystal-lang
Human_G33k has quit [Remote host closed the connection]
<erdnaxeli> Hi, this gitter channel used to be bridged with a room on Matrix. But the bot (on gitter side) responsible for the bridging was banned on the 1st of january 2018, hence breaking the bridge. Should it be possible to maybe unban the bot (it's matrixbot), in order to restore the bridge? Or was there a good reason to ban it?
<erdnaxeli> currently I am also talking from matrix, but from the room bridged to the freenode channel, itself bridged to gitter
<FromGitter> <anthonyshull> is there a recommended HTTP client library that does things like base_uri, headers, and retries?
<FromGitter> <Blacksmoke16> stdlib can do most of that
<FromGitter> <Blacksmoke16> minus the retry part, but should be easy enough to handle id think
<FromGitter> <watzon> @anthonyshull it's recommended to use the stdlib HTTP client if possible. If you really need the extra features there's Halite and Crest, but they come at a major speed decrease.
Human_G33k has joined #crystal-lang
<FromGitter> <watzon> I use to use Halite for my Tourmaline library until I learned that it was the reason my latency was so bad
<FromGitter> <anthonyshull> this is just for demo so speed isn't a problem
<FromGitter> <Blacksmoke16> also consider its another dependency
<FromGitter> <Blacksmoke16> that could change/break etc
<FromGitter> <Blacksmoke16> there is an issue about revamping the http client in the stdlib to support more stuff, but id imagine thats an after 1.0 thing
<FromGitter> <watzon> Which happens plenty
<FromGitter> <anthonyshull> yeah, i'll probably just use HTTP::Client
<FromGitter> <watzon> Speaking of 1.0, is that ever gonna happen? Here I was thinking 3 months ago that it would be right around the corner, yet here we are still on 0.35.1
<FromGitter> <Blacksmoke16> or if anything make your client type wrap it
<FromGitter> <Blacksmoke16> @watzon theres a PR for first prerelease
<FromGitter> <watzon> Woop woop
<FromGitter> <watzon> Can't come soon enough
<FromGitter> <tenebrousedge> @watzon o/
<FromGitter> <watzon> What's up O/
<FromGitter> <tenebrousedge> not a lot. Took a break from coding in order to learn makeup and stuff. Starting to pick that up again
<FromGitter> <watzon> Fun fun haha. I'm actually dealing with some marketing shit right now myself.
<FromGitter> <watzon> Trying to finesse the HubSpot API to do what we need
<FromGitter> <Blacksmoke16> :thinking: i think you should reread what he said @watzon 😆
<FromGitter> <anthonyshull> if i do `module Foo::Bar` is that the same as nesting a Bar module in a Foo module?
<FromGitter> <Blacksmoke16> yes
<FromGitter> <anthonyshull> noice
<FromGitter> <Blacksmoke16> can also do like `class Foo::Bar::MyClass`
<FromGitter> <anthonyshull> yeah, i saw that too. perfect.
<FromGitter> <watzon> LMAO
<FromGitter> <watzon> Man I'm tired
<FromGitter> <watzon> Time to go back to bed
<FromGitter> <erdnaxeli_gitlab> > *<erdnaxeli>* Hi, this gitter channel used to be bridged with a room on Matrix. But the bot (on gitter side) responsible for the bridging was banned on the 1st of january 2018, hence breaking the bridge. Should it be possible to maybe unban the bot (it's matrixbot), in order to restore the bridge? Or was there a good reason to ban it? ⏎ ⏎ Hi, I'm the same guy. Who are the admins there?
<FromGitter> <watzon> Makeup is cool too lol
<FromGitter> <tenebrousedge> @Blacksmoke16 pronouns are she / her these days
<FromGitter> <watzon> @erdnaxeli_gitlab I think @oprypin is in charge of the IRC bridge. Might be a good place to start.
<FromGitter> <erdnaxeli_gitlab> thanks
<oprypin> i'm not aware of any ban but i am opposed to such a bot
<oprypin> erdnaxeli, can't Matrix just use IRC?
<FromGitter> <erdnaxeli_gitlab> it can but why couldn't it use a bridge with a better integration?
<oprypin> better for you, worse for everyone else
<FromGitter> <erdnaxeli_gitlab> what is worse?
<oprypin> <FromGitter> <MatrixSuperBot[m]> <erdnaxeli> aaaaa ?
<FromGitter> <erdnaxeli_gitlab> I'm looking at how the integration looks on gitter side
<oprypin> erdnaxeli, do you have any particular problem that you want to solve?
<FromGitter> <erdnaxeli_gitlab> my problem is that relay bots looks ugly, and it could be way better on matrix side with a proper bridge. But indeed on the gitter side it would be another relay bot. A solution could be to do IRC <-> Matrix (this bridge does not use relay bot but actually connects users) and then Matrix <-> gitter
<erdnaxeli> here I am talking from Matrix but you don't see any relay bot on IRC
<oprypin> there is a bot bridging 2 channels. you cannot add another bot that's aware only of one side, you have to be responsible for a 3-way implementation
<erdnaxeli> anyway as Element (the guy behind matrix) bought Gitter a proper bridge (without relay bot on gitter side) is coming
<oprypin> erdnaxeli, > here I am talking from Matrix but you don't see any relay bot on IRC - well yes, why not just do that?
<erdnaxeli> because for users talking on gitter I see the relay bot as you do en IRC
<erdnaxeli> <oprypin "there is a bot bridging 2 channe"> I'm not sure to understand, but IRC <-> Matrix <-> Gitter is totally doable
<FromGitter> <anthonyshull> so, is the pattern to basically require everything in your main entry point file and then not need requires internally?
<erdnaxeli> Matrix is not a client, is a protocole with its own clients
<FromGitter> <anthonyshull> as long as everything is namespaced it will work?
<FromGitter> <Blacksmoke16> thats how i tend to do it yea. There are glob based requires, but you can run into issues with that
<oprypin> anthonyshull, oh no, please don't do that.
<FromGitter> <Blacksmoke16> it would also work to have sub main files that requires things, then you require that file in the main file
<FromGitter> <Blacksmoke16> if you have a lot of files or something
<FromGitter> <oprypin> `require "sub/*"` ⏎ ⏎ is like writing this ⏎ ⏎ *sub/a.cr*: ... [https://gitter.im/crystal-lang/crystal?at=5fb562c1b4283c208a722fcc]
<FromGitter> <oprypin> and like, why would you do that
<FromGitter> <Blacksmoke16> it has its uses but yea, most of the time its a bad idea
<oprypin> the only good rule is to require exactly what you use. and i wish there was an enforcing tool
<oprypin> such a tool is possible to make. i even have an idea but it'd have to be part of the compiler to not be hugely messy
<FromGitter> <anthonyshull> what i'm really trying to accomplish is to have a SDK that looks like:
<FromGitter> <anthonyshull> ```client = ShipEngine::ShipEngine.new "API_KEY" ⏎ client.address.query(...)``` [https://gitter.im/crystal-lang/crystal?at=5fb563b88d286f2076b94e13]
<FromGitter> <Blacksmoke16> well to be clear thats different than `require`
<FromGitter> <Blacksmoke16> the end user would prob have a `require "ship_engine"` or something
<FromGitter> <anthonyshull> where the `address` in `client.address` is a service that has access to that API_KEY and other config
<FromGitter> <Blacksmoke16> of which all your files and stuff is included in `src/ship_engine.cr`
<FromGitter> <anthonyshull> yeah, i'm just trying to figure out how to even structure this
<FromGitter> <tenebrousedge> have a version file, for great justice
<FromGitter> <tenebrousedge> also an entry point, which requires the version file, then anything else it needs directly
<FromGitter> <anthonyshull> do you have a good example of that somewhere?
<erdnaxeli> <oprypin "the only good rule is to require"> i would like such a tool
<FromGitter> <tenebrousedge> crystal init lib libmeow ⏎ mv libmeow/src/{libmeow,VERSION}.cr ⏎ cat << EOF > libmeow/src/libmeow.cr ⏎ require "./VERSION" ⏎ ... [https://gitter.im/crystal-lang/crystal?at=5fb566eff2fd4f60fc802815]
hightower2 has joined #crystal-lang
<FromGitter> <tenebrousedge> s/module/class as need be
<hightower2> Hey for a list of strings, I need to check whether they are "allowed". What's the best structure for this? Do I keep calling e.g. `if list.includes?(word)`, or use a Hash and check with h[word]?, or even use a Set?
<hightower2> Or even a tuple/named tuple? The list of allowed words has about 10 fixed/static entries.
<FromGitter> <tenebrousedge> I would do `entries - ["abc", "bcd"]`
<hightower2> You wouldn't care about this creating an object as aside effect?
<FromGitter> <tenebrousedge> not unless `entries` was large
<hightower2> ok, nice idea, thanks. (Still if someone has a recommendation for one of the 5 data structures mentioned above, it would be appreciated, just for info if nothing else)
<oprypin> hightower2, if u create the set of words once, create it as a `Set`
<FromGitter> <tenebrousedge> if you want the allowed stuff in `entries` you could do `allowed_entries = entries & allowed`
<FromGitter> <tenebrousedge> and yes `Set` is best
<hightower2> ++
<FromGitter> <tenebrousedge> `Set` and `Array` both have `&` and `-`
<FromGitter> <tenebrousedge> `Set` also has `superset?`
<FromGitter> <tenebrousedge> and `subset?`
<oprypin> those have no chance of outperforming `.all .includes`
<FromGitter> <anthonyshull> what does ::One::Two mean?
<FromGitter> <anthonyshull> or is that just a ruby thing?
<oprypin> means `One::Two` but doesn't allow `Submodule::One::Two` if you're in `Submodule`
<FromGitter> <anthonyshull> ah, cool, thanks
hightower3 has joined #crystal-lang
hightower2 has quit [Ping timeout: 240 seconds]
<hightower3> As a side question, if I want to count on crystal to raise an exception if a key is missing, such as `["a", "b", "c"].each { |x| hash[x] }` will this work fine or possibly be optimized away ?
<oprypin> seems ok
<FromGitter> <tenebrousedge> I might use `all?` instead of `each` there, depending on exactly what you're after
Human_G33k has quit [Remote host closed the connection]
<hightower3> Hm, since the params are coming from HTTP::Params, the code I have is now: `allowed_params = Set{"one", "two"}; invalid_params = context.request.query_params.to_h.keys.to_set - allowed_params`. Not very elegant. Any hints there?
Human_G33k has joined #crystal-lang
<FromGitter> <tenebrousedge> use `query_params.reject(&->allowed.includes?(String))`
<FromGitter> <tenebrousedge> or something similar
<FromGitter> <Blacksmoke16> is this so you can return an error to the client or something?
<hightower3> Blacksmoke16: right, the API which I need to replicate does this, so I need to too.
<FromGitter> <Blacksmoke16> gotcha
<FromGitter> <3n-k1> is there a way to construct a method call from a macro?
<FromGitter> <Blacksmoke16> prob yea, got some sample code?
<FromGitter> <3n-k1> like, i have the class name, and i have the method name. i tried `#{{{var.id}}.{{var.type.class.methods[1].name}}()}` but that just doesn't work
<FromGitter> <Blacksmoke16> doesnt work how/
<FromGitter> <3n-k1> full code: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5fb56f6c8d286f2076b96f99]
chloekek has left #crystal-lang ["Leaving"]
<FromGitter> <Blacksmoke16> would it be easier to use like https://crystal-lang.org/api/master/ECR.html#def_to_s(filename)-macro
<FromGitter> <Blacksmoke16> er nvm, that works diff than i remember
<FromGitter> <3n-k1> i'd like to stay away from ecr, i think that would complicate this a lot
<oprypin> 3n-k1, what's the #{ doing there, i dont get it
<FromGitter> <3n-k1> string interpolation
<FromGitter> <Blacksmoke16> idt you need that when using macros
<oprypin> 3n-k1, where's the string though?
<FromGitter> <3n-k1> i'd be using the macro to construct the method call, and the result of that is interpolated into the string
<FromGitter> <3n-k1> oprypin: it's a heredoc
<FromGitter> <Blacksmoke16> can you make a playground link?
<FromGitter> <3n-k1> i'm just gonna append strings
<oprypin> 3n-k1, macros in heredocs may just be broken
<FromGitter> <3n-k1> i think that's the simplest solution
<oprypin> can u put the expression outside? it's so confusing like this
<FromGitter> <3n-k1> i think it's a syntax thing, yeah
<FromGitter> <3n-k1> when i put it outside, it works fine
<FromGitter> <Blacksmoke16> might be able to use fresh vars then use those to interpolate?
<FromGitter> <3n-k1> that worked perfectly!
<FromGitter> <3n-k1> ty :)
<FromGitter> <anthonyshull> not seeing it in the documentation, is there a way to manipulate symbols when creating a macro?
<FromGitter> <Blacksmoke16> in what regard?
<FromGitter> <Blacksmoke16> symbols are immutable
<FromGitter> <anthonyshull> i think token is the better word
<FromGitter> <anthonyshull> something like:
<FromGitter> <anthonyshull> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5fb57b61bf955735eb89d64e]
<FromGitter> <Blacksmoke16> i assume theres more to it? why not just write the method?
<FromGitter> <anthonyshull> that was just an example i grabbed
<FromGitter> <Blacksmoke16> but you should be able to do like `name.id.downcase`
<FromGitter> <anthonyshull> basically i want to say something like `inject Address`
<FromGitter> <anthonyshull> and that expands to
<FromGitter> <anthonyshull> `self.address = ShipEngine::Services::Address.new ...`
<FromGitter> <anthonyshull> or i guess:
<FromGitter> <anthonyshull> ```def self.address ⏎ ShipEngine::Services::Address.new ... ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5fb57c037cac87158fb4dfb8]
<FromGitter> <Blacksmoke16> where to the args to it come from?
<FromGitter> <anthonyshull> from the wrapping class
<FromGitter> <Blacksmoke16> you can do like `class_getter address : ShipEngine::Service::Address { ShipEngine::Services::Address.new .. }`
<FromGitter> <Blacksmoke16> which would only instantiate it when its called
<FromGitter> <Blacksmoke16> and essentially act as a singleton
<FromGitter> <anthonyshull> hum, i'll give that a try
<FromGitter> <Blacksmoke16> if its ok that multiple invocations of it can share the same obj ofc
ua_ has quit [Ping timeout: 256 seconds]
ua_ has joined #crystal-lang
<FromGitter> <j8r> @Blacksmoke16 @oprypin worse is `./dir/**`
<FromGitter> <j8r> if you know you need everything on a directory, it `/*` is fine.
<FromGitter> <Simerax> Ive seen that 1.0 is in the making or at least Pull 9892 Release 1.0.0-pre1 (https://github.com/crystal-lang/crystal/pull/9892). There are a few things related to windows . Will this mean 1.0 will ship with windows support or is it more like one step closer to windows support?
<FromGitter> <Blacksmoke16> Windows support isn't a goal of 1.0
<FromGitter> <Blacksmoke16> Though it does include some things to get a bit closer iirc
<FromGitter> <3n-k1> is the windows-support meta issue still current?
<FromGitter> <Blacksmoke16> Yes
<FromGitter> <3n-k1> ~~refusing to support windows to try and force people into the *nix land~~
<FromGitter> <Simerax> thanks for the info. i guess ill check out the "meta issue" then :D
<FromGitter> <3n-k1> it's here if you don't have it already https://github.com/crystal-lang/crystal/issues/5430
<FromGitter> <Simerax> thanks
<oprypin> Simerax, nobody is really working on Windows support. i'm just keeping it barely alive
<oprypin> the most exciting recent development is https://github.com/crystal-lang/crystal/issues/6957#issuecomment-724278204
_whitelogger has joined #crystal-lang
sorcus has joined #crystal-lang
erdnaxeli has quit [Ping timeout: 240 seconds]
<hightower3> hm, what shard should I use for talking to RabbitMQ ?
<FromGitter> <Blacksmoke16> er sorry
<FromGitter> <Blacksmoke16> that one
<hightower3> aha the cloudamqp one, ok thanks!
erdnaxeli has joined #crystal-lang