<FromGitter>
<thetrung> so ppl mostly use Crystal for Amber ?
<FromGitter>
<randiaz95> For shizzzle
<FromGitter>
<Blacksmoke16> amber/lucky/kemal are popular choices if building a webapp but deff arent the only things crystal can do
<FromGitter>
<randiaz95> Crystal is good for fast probability computation because of simple data structure apis and methods like permutations
<FromGitter>
<randiaz95> Crystal also has the best syntax for the runtime performance
ur5us has quit [Ping timeout: 260 seconds]
<FromGitter>
<kinxer> I can't give any specifics, but the company I work for uses Crystal for non-web applications that require heavy computation and network communication.
<FromGitter>
<kinxer> So it's definitely not only for web stuff.
DTZUZO has quit [Read error: Connection reset by peer]
return0e has quit [Read error: Connection reset by peer]
<FromGitter>
<randiaz95> all I got there was: `return and break can't be used inside a captured block. next can be used and will exit and give the value of the captured block.`
<FromGitter>
<wontruefree> is there an upsert for lucky?
<FromGitter>
<grkek> Hello
yukai has quit [Ping timeout: 260 seconds]
ht_ has joined #crystal-lang
ht_ has quit [Quit: ht_]
return0__ has joined #crystal-lang
<FromGitter>
<grkek> @Blacksmoke16 I finally got it to work, it has the same capabilities as the dsl of the kemal framework had but it gets the path from the route() macro, I also updated the readme it is really nice, I love crystal
return0e has quit [Ping timeout: 260 seconds]
_whitelogger has joined #crystal-lang
DTZUZO has quit [Ping timeout: 260 seconds]
<FromGitter>
<Blacksmoke16> 👍
<FromGitter>
<Blacksmoke16> nice one
<FromGitter>
<grkek> Thank you ! <3
<FromGitter>
<Blacksmoke16> i also slept on my yaml config idea and realized i can just include the string content at compile time, but not process it until you run it so that it can handle picking up env vars etc
<FromGitter>
<grkek> sleep makes everything better
<FromGitter>
<Daniel-Worrall> Yes storing defaults in the app and then overriding with an optional config file is a common good practice
<FromGitter>
<kingsleyh> Does anyone know why on JSON::Any there is no `as_u64` or any other as_u for that matter - but when using JSON.mapping you can set a field as UInt64 and it works fine? And also if you JSON.parse(json)["value"].as_s.to_u64 - although it seems fine - when you come to use it it throws a cast exception - so the only way to do it is to use the JSON.mapping way?
<FromGitter>
<Daniel-Worrall> What does it give with as_i?
vitalyster has joined #crystal-lang
FromGitter has quit [Read error: Connection reset by peer]
FromGitter has joined #crystal-lang
DTZUZO has joined #crystal-lang
<FromGitter>
<j8r> @kingsleyh Because JSON spec doesn't have unsigned ints
<FromGitter>
<j8r> as @Daniel-Worrall said, you can use `as_i.to_u64`
<FromGitter>
<kingsleyh> Yes works with as_i thanks
<FromGitter>
<kingsleyh> Is that how Json mapping does it under the hood?
HumanGeek has quit [Remote host closed the connection]
HumanGeek has joined #crystal-lang
duane has joined #crystal-lang
Human_G33k has quit [Ping timeout: 258 seconds]
return0__ has quit [Ping timeout: 268 seconds]
f1reflyylmao has quit [Quit: bye fags]
f1refly has joined #crystal-lang
return0e has joined #crystal-lang
edr has joined #crystal-lang
Flipez has quit [Read error: Connection reset by peer]
Flipez3 has joined #crystal-lang
Flipez3 is now known as Flipez
duane has quit [Ping timeout: 260 seconds]
<FromGitter>
<j8r> Wow, I have a very nasty bug with `JSON::Serializable`
duane has joined #crystal-lang
<FromGitter>
<j8r> On one hand, I am happy that's not my code and it is working with `JSON.mapping`. ⏎ On the other hand, hard to isolate
<FromGitter>
<j8r> forget, still occurring 💀
<FromGitter>
<tenebrousedge> can you isolate it and put it in a play for us?
<FromGitter>
<j8r> i really wish I could
<FromGitter>
<j8r> trying to do it
<FromGitter>
<j8r> does `forall U` known to be buggy? ⏎ I have a method `def parse_response(klass : U.class, response) : Success(U) | Error forall U`
<FromGitter>
<tenebrousedge> I think I've heard something to that effect
<FromGitter>
<tenebrousedge> but I couldn't be sure
<FromGitter>
<j8r> me too, I know generics are kinda limited
<FromGitter>
<j8r> for example better avoiding abstract classes with generics with macros
<FromGitter>
<j8r> I make it compiling by replacing a type to `JSON::Any`, definitely a JSON issue. ⏎ I have to look to the macro
<FromGitter>
<j8r> hooooo
<FromGitter>
<j8r> found it
<FromGitter>
<j8r> if you put a type as `Nil`, but it is not - this will return an invalid memory access
<FromGitter>
<tenebrousedge> that does sound like a bug
<FromGitter>
<j8r> Yes, I am trying to reproducing it
<FromGitter>
<grkek> I get segfaults sometimes when I code spaghetti as well lmao
duane has quit [Ping timeout: 240 seconds]
<FromGitter>
<tenebrousedge> mmmm, spaghetti 😄
<FromGitter>
<Blacksmoke16> i had that last night
<FromGitter>
<Blacksmoke16> 🍝
<FromGitter>
<j8r> I am able to reproduce it, and that's even no spaghetti :)
<FromGitter>
<Blacksmoke16> @Daniel-Worrall ☝️ December 23, 2019 7:36 AM (https://gitter.im/crystal-lang/crystal?at=5e00b4bec5a23938b46abdca) thats the plan. have a parent struct that controls the sections, with other structs defining the options for a specific feature. this way defaults/documentation can be added, otherwise it would fail when going to do the `from_yaml`
<FromGitter>
<Blacksmoke16> can also read in the yaml when building the binary so it doesn't actually have to be present to run. I.e. `read_file` macro then process the dynamic content at runtime when the binary starts so that env vars will be set correctly etc
<FromGitter>
<grkek> mmmm, grip framework which handles lots of requests/s
<FromGitter>
<Blacksmoke16> granted i have a good pc and there wasnt really anything going on in the route, just returns `"Hello world"` so i wouldnt call it official numbers ha
<FromGitter>
<grkek> Damn that is strong as hell
<FromGitter>
<grkek> I still havent figured how can I run workers with kemal
<FromGitter>
<grkek> do you have some ideas about that ?
<FromGitter>
<Blacksmoke16> each request is handled in its own fiber
<FromGitter>
<Blacksmoke16> so you should just be able to enable MT mode and set the workers you want, defaults to 4
<FromGitter>
<grkek> is there a cli command for that for the crystal compiler ?
<FromGitter>
<Blacksmoke16> oh, did you use the `--release` flag @grkek ?
<FromGitter>
<Blacksmoke16> when testing your thing
<FromGitter>
<grkek> yup
<FromGitter>
<Blacksmoke16> 👍 cool
<FromGitter>
<grkek> it increases a ton
<FromGitter>
<grkek> at least I can be proud that it shtomped the django speeds
<FromGitter>
<grkek> interesting default kemal seems to be achieving the same speed
<FromGitter>
<grkek> @Blacksmoke16 after compiling it with multi threading how do you specify workers ? using an env variable ?
<FromGitter>
<Blacksmoke16> yea `CRYSTAL_WORKERS`
<FromGitter>
<Blacksmoke16> defaults to 5
<FromGitter>
<Blacksmoke16> 4*
<FromGitter>
<grkek> okay let me add some adjustments to my code
olbat[m] has quit [Quit: killed]
erdnaxeli has quit [Quit: killed]
ternarysolo has quit [Quit: killed]
beepdog has quit [Quit: killed]
<FromGitter>
<grkek> It somehow got worse speeds now lol
<FromGitter>
<Blacksmoke16> is possible, extra workers is extra overhead
<FromGitter>
<grkek> Interesting
<FromGitter>
<j8r> if you want to scale a lot more, make it stateless
<FromGitter>
<j8r> then spawn a lot of them around
<FromGitter>
<j8r> on multiple hosts
<FromGitter>
<grkek> the more workers I use the worse it gets
<FromGitter>
<Blacksmoke16> unless you have the computer that can handle more workers, that makes sense
<FromGitter>
<kinxer> How many cores does your processor have?
<FromGitter>
<grkek> 4 i think
<FromGitter>
<grkek> or 8
<FromGitter>
<grkek> 4
<FromGitter>
<grkek> yeah
<FromGitter>
<Blacksmoke16> prob dont want to run more than 4 then
<FromGitter>
<grkek> that is interesting
<FromGitter>
<Blacksmoke16> usually you want 1 worker per cpu core
<FromGitter>
<kinxer> Does the scheduler use its own process?
<FromGitter>
<grkek> I can use the reuse port feature of kemal to run multiple instances hehe
<FromGitter>
<Blacksmoke16> that is also an option, but i would imagine the overhead of separate processes would be more than MT mode?
<FromGitter>
<grkek> 11176
<FromGitter>
<grkek> yay performance increase
<FromGitter>
<grkek> 4 processes
<FromGitter>
<kinxer> Er, in its own thread, I meant.
<FromGitter>
<Blacksmoke16> :shrug:
<FromGitter>
<grkek> 2 processes
<FromGitter>
<grkek> still 11k
<FromGitter>
<grkek> interesting
<FromGitter>
<Blacksmoke16> what does kemal proper get?
<FromGitter>
<grkek> same probably
<FromGitter>
<grkek> let me test
<FromGitter>
<jwoertink> So I have this code where there's a macro method that takes a type declaration then shoves that in to an array. I want to sort that array where the nillable type declarations are at the end
<FromGitter>
<grkek> seems like both perform the same
<FromGitter>
<Blacksmoke16> oo i remember running into this
<FromGitter>
<grkek> 11k on both
<FromGitter>
<grkek> well I must say its about same as crystal but more of an object oriented approach
<FromGitter>
<grkek> kemal*
<FromGitter>
<Blacksmoke16> @jwoertink i remember this but i cant remember what i did :/
<FromGitter>
<grkek> @Blacksmoke16 does your framework support unix sockets ?
<FromGitter>
<jwoertink> ah. no worries. I'll keep hammering away
return0e has quit [Read error: Connection reset by peer]
<FromGitter>
<jwoertink> I know I can break them out in to 2 separate arrays using `reject` and `select`, but the code got super verbose real quick. Maybe that's the best way though?
return0e has joined #crystal-lang
<FromGitter>
<Blacksmoke16> oo nvm i figured it out
<FromGitter>
<Blacksmoke16> well fwiw, id use enum symbol autocasting and do `"Hi", :created`
<FromGitter>
<grkek> cuz it is an enum ?
<FromGitter>
<grkek> that might be one as well
<FromGitter>
<grkek> do it like
<FromGitter>
<grkek> elixir
<FromGitter>
<grkek> :ok, "Muh content"
<FromGitter>
<grkek> :created, "ohoy"
<FromGitter>
<grkek> :not_found, "sowwy"
<FromGitter>
<Blacksmoke16> i still up in the air, however i think im missing a layer
<FromGitter>
<Blacksmoke16> is*
<FromGitter>
<grkek> do you have a response object as well ?
<FromGitter>
<Blacksmoke16> no thats the part that im still debating
<FromGitter>
<Blacksmoke16> in that like the response is supplied via the `HTTP::Server::Context`
<FromGitter>
<Blacksmoke16> so one option would be like have my own `Response` object that can be returned that gets returned directly, otherwise have a view layer to handle the conversion of the return value into a `Response`
<FromGitter>
<grkek> kemal is using HTTP::Server::Context directly so I went with it
<FromGitter>
<grkek> comfy af
<FromGitter>
<mattrberry> Hey! Sorry for interrupting, not sure if there's a way to have threaded conversation on gitter... ⏎ ⏎ Is there a way to create a macro that would automatically define a constructor for all properties on a class? I'd like all classes inheriting from a Parent class to have their constructors automatically defined. I was looking at the the `inherited` macro hook, but I'm a little confused at the minute. I
<FromGitter>
<Blacksmoke16> `@type.instance_vars` only works in context of a method
<FromGitter>
<grkek> rip
<FromGitter>
<mattrberry> Is there a way to do what I'm looking for? Could I maybe define a catch-all `initialize` method that could then parse out the values given to it inside the of the constructor?
<FromGitter>
<Blacksmoke16> @grkek sorry if i didnt make it clear before, but when im saying "doesnt support x yet" im talking about the rewrite of athena
<FromGitter>
<Blacksmoke16> its possible in the latest release, just not in master/my WIP branch
<FromGitter>
<Blacksmoke16> @mattrberry got a better example of what you're trying to achieve? just to save yourself from having to manually add an initializer?
<FromGitter>
<grkek> that is a whole new level of programming
<FromGitter>
<grkek> fuck initializers who need those
<FromGitter>
<grkek> fuck it lets take it out of crystal
<FromGitter>
<Blacksmoke16> you would make a macro that makes defining them easier, but otherwise you're out of luck
<FromGitter>
<Blacksmoke16> could*
<FromGitter>
<tenebrousedge> I feel like this should be possible <___<
<FromGitter>
<tenebrousedge> but I suspect that the answer to this is "use a struct instead"
<FromGitter>
<Groogy> I finally have time to look over my old libraries to make sure they are up to date to the latestest versions and now I have mentions on awesome-crystal and I don't understand at all what they are talking about
<FromGitter>
<Blacksmoke16> you just need to setup periodic CI builds (assuming your project is testable, if not i can add it to the exempt list)
<FromGitter>
<Groogy> Ah I don't do specs really but think I might have done some for the memory profiler
<FromGitter>
<Groogy> Boleite I have not written specs for though since I use contract programming instead
<FromGitter>
<Blacksmoke16> awesome-crystal is going thru some cleanup atm removing shards that dont have CI setup
<FromGitter>
<Blacksmoke16> the goal being to ensure all the shards compile and work as intended
<FromGitter>
<Groogy> Alright so Boleite and Trashman is sort of real hard to write specs for so I haven't put in the time to do that
<FromGitter>
<Groogy> but I could probably set it up for crystal-clear but right now it does not have that
<FromGitter>
<Blacksmoke16> doesn't *have* to be specs
<FromGitter>
<Blacksmoke16> an example program to ensure it still compiles would be fine
<FromGitter>
<Groogy> Hmm will see what I can do over my vacation
<FromGitter>
<Blacksmoke16> 👍
<FromGitter>
<Groogy> Boleite will be up to date to the latest version at least
<FromGitter>
<Groogy> I am fixing all of the // problems
<FromGitter>
<mattrberry> Essentially, I'd just like to not have to define a constructor, ==, hash, or a handful of other methods in each class, since the classes are primarly used as dataclasses. I'm coming from a project that used Python's dataclasses extensively, and I'd like to do something similar here. I've found lbarasti/dataclass (https://github.com/lbarasti/dataclass), but I don't love the syntax. @Blacksmoke16 do you think
<FromGitter>
... it's possible to do something similar with just a @[dataclass] annotation on a class?
<FromGitter>
<mattrberry> If it's possible, I'll just hack around until I get it to work / get familiar with the Crystal macro system
<FromGitter>
<Blacksmoke16> its not anything personal, see my response there and the rest of the thread for the reasoning
<FromGitter>
<Groogy> Yeah I get it Blacksmoke don't worry
<FromGitter>
<Blacksmoke16> ❤️
sagax has quit [Read error: Connection reset by peer]
<FromGitter>
<Blacksmoke16> @mattrberry im assuming you cant use inheritance or something?
<FromGitter>
<Groogy> I have like 3 jobs at same time at work right now otherwise I'd devoted more time to keeping track of crystals development
<FromGitter>
<Blacksmoke16> or a module that defines the common logic that can be included into each type
<FromGitter>
<Blacksmoke16> no worries bud
<FromGitter>
<Groogy> So now I am "relaxing" by coding some crystal :D
<FromGitter>
<Groogy> Drinking Spanish wine on my sisters balcony and being glad I don't have to deal with the Swedish misery of a winter
<FromGitter>
<grkek> @Blacksmoke16 damn you evil
<FromGitter>
<grkek> you be like
<FromGitter>
<grkek> lets clap these bunch of repos
<FromGitter>
<grkek> for no reason
<FromGitter>
<Groogy> Oh dear god, so many warnings after getting things to compile
<FromGitter>
<Blacksmoke16> :S
<FromGitter>
<Groogy> is it now required to have a return type all the time?
<FromGitter>
<Groogy> @grkek nah I get it
<FromGitter>
<Blacksmoke16> for abstract defs, the children must have the same/stricter type set
<FromGitter>
<Groogy> keeping a clean list for people to look over to find things that actually work and is maintained is important
<FromGitter>
<grkek> yeah but its a bit rude to the creators
<FromGitter>
<grkek> creating something which makes you happy being clapped is kinda sad
<FromGitter>
<Groogy> Well if they don't want to put in the effort they can just opt out
<FromGitter>
<mattrberry> @Blacksmoke16 Right, the fields different for each class
<FromGitter>
<Blacksmoke16> > Well if they don't want to put in the effort they can just opt out ⏎ ⏎ this
<FromGitter>
<Groogy> I was just overwhelemd by how much have changed since I last touched my code base
<FromGitter>
<Groogy> luckily it seems memory profiler and the contract testing works as it should though
duane has joined #crystal-lang
<FromGitter>
<Blacksmoke16> nice one, if to start you just want to write like 1 spec to cover the happy path, that would be a good start
<FromGitter>
<dscottboggs_gitlab> I tend to notice mistakes a lot in that phase even on other paths
<FromGitter>
<Blacksmoke16> @mattrberry i suppose you could define your own macro like `record`
<FromGitter>
<Blacksmoke16> that creates what you want
<FromGitter>
<Blacksmoke16> similar to that dataclass shard
<FromGitter>
<tenebrousedge> I think `record` is the answer here
<FromGitter>
<Blacksmoke16> afk a bit, drivin home
<FromGitter>
<grkek> Go for it mate
<FromGitter>
<dscottboggs_gitlab> yeah @mattrberry , I don't think an annotation will help you here -- annotations don't work at all like they do in python here
<FromGitter>
<Groogy> would that remove the warning?
<FromGitter>
<dscottboggs_gitlab> yes, like that
<FromGitter>
<Groogy> nice thx
<FromGitter>
<dscottboggs_gitlab> which warning is that?
<FromGitter>
<mattrberry> Yeah i'm basically looking for the functionality of lbarasti/dataclass (https://github.com/lbarasti/dataclass) but with syntax closer to what you just shared @dscottboggs_gitlab! Do you think both of those are achievable? I'm still just trying to figure out how the crystal macro system works, so if those are things that *should* be achievable then I'll try to figure out how to do that!
<FromGitter>
<dscottboggs_gitlab> sorry spoke too soon @Groogy I didn't see you had a warning
<FromGitter>
<Groogy> The warning about that you should have explicit return types
<FromGitter>
<Groogy> I'm trying to update my frameworks to fit the latest version of crystal
<FromGitter>
<Groogy> What's the "prettiest" way to do this now?
<FromGitter>
<dscottboggs_gitlab> Hm, I still seem to be a version behind, so I'm not getting that error, but adding ` : Typename` is the way to add a type restriction to a property
<FromGitter>
<dscottboggs_gitlab> like `property backend : Boleite::BackendConfiguration`
<FromGitter>
<Groogy> I know but that would make it end up being `property backend : Boleite::BackendConfiguration = Boleite::BackendConfiguration.new`
<FromGitter>
<Groogy> and I am wondering if there's a prettier way to do this
duane has quit [Ping timeout: 258 seconds]
<FromGitter>
<Groogy> It's this warning: ```Please add an explicit return type (Bool or a subtype of it) to this method as well. ⏎ ⏎ The above warning will become an error in a future Crystal version.```
<FromGitter>
<tenebrousedge> you can usually do `property backend : BackendConfiguration = BackendConfiguration.new`
<FromGitter>
<dscottboggs_gitlab> that's what he's trying *not* to do
<FromGitter>
<Groogy> Well trying not to do is a bit strong, just wondering if there's a prettier way to do it
duane has joined #crystal-lang
<FromGitter>
<Groogy> I could have the assignment on the next line for clarity
<FromGitter>
<tenebrousedge> @dscottboggs_gitlab I'm saying you can omit the namespace
<FromGitter>
<dscottboggs_gitlab> ah
<FromGitter>
<grkek> @Groogy Your website is broken
<FromGitter>
<tenebrousedge> another option is to pass the default in the initializer
<FromGitter>
<Groogy> I used that when I was a student and looking for a job :P
<FromGitter>
<grkek> is it in wordpress
<FromGitter>
<grkek> probably
<FromGitter>
<Groogy> not much point to maintain it
<FromGitter>
<Groogy> yeh
<FromGitter>
<dscottboggs_gitlab> @mattrberry, yep, I'm looking over the code for that shard now and it looks like it would be pretty trivial to create something based off of that which uses nested macros to build out the methods from the `@type` macro value inside the generated class.
<FromGitter>
<grkek> Still it would be nice to have it up
<FromGitter>
<tenebrousedge> another option is to use aliases
<FromGitter>
<dscottboggs_gitlab> that said it's not a small project for someone not familiar with Crystal macros as it touches a lot of different concepts
<FromGitter>
<Groogy> @grkek I mean "my website" these days is paradoxplaza.com :P
<FromGitter>
<Groogy> But yah you are probably right I should probably get it just not show an error message at least
<FromGitter>
<dscottboggs_gitlab> nested macros, both kinds of macros, the `@type` special value, etc, etc
<FromGitter>
<grkek> Thats a cool website
<FromGitter>
<grkek> is it yours ?
<FromGitter>
<Groogy> Haha no not really. It's just where I work :D
<FromGitter>
<grkek> Aw nice
<FromGitter>
<grkek> dont you just hate it when you have a beard and you pull out each one of the hairs while you think about how to implement something
<FromGitter>
<grkek> it is a pretty horrible coping mechanism
<FromGitter>
<grkek> :D
<FromGitter>
<Groogy> For me it's gnawing on the nails
<FromGitter>
<Groogy> But yeah I should fix my website so I can link the stuff I've done on Crystal in it
<FromGitter>
<dscottboggs_gitlab> treat yo beard with respect lol
<FromGitter>
<grkek> I used to do that
<FromGitter>
<grkek> and now it went from nails to beard and eyebrows
<FromGitter>
<grkek> once I got so mad at myself i shaved both of them lmao
<FromGitter>
<grkek> and then got depressed
<FromGitter>
<Groogy> take care of yourself, even though I bite my nails I know it is a super bad stress induced behaviour
<FromGitter>
<Groogy> and try my best to get rid of it
<FromGitter>
<grkek> > stress
<FromGitter>
<grkek> that gave me baldspots on my head
<FromGitter>
<grkek> humans weren't designed to think
<FromGitter>
<grkek> something went wrong
<FromGitter>
<grkek> I should be running around woods rn screaming ooga booga
<FromGitter>
<bew> Lol, hey @Groogy welcome back!
<FromGitter>
<Groogy> Hey @bew thanks!
<FromGitter>
<Groogy> Got vacation so can finally try and update everything
<FromGitter>
<Groogy> I am also Twitch affiliate now and I have been pondering if I should do a Game Design/Programming in crystal stream
<FromGitter>
<grkek> I love talking to you guys, literally have no one to talk to about crystal or programming in general
<FromGitter>
<grkek> @Groogy that would be nice
<FromGitter>
<mattrberry> @dscottboggs_gitlab Alright well I'll dive in and give it a shot! I'm sure I'll have plenty of questions down the line. Thanks!
<FromGitter>
<Groogy> @grkek you working with programming or it's your hobby?
<FromGitter>
<grkek> Both
<FromGitter>
<dscottboggs_gitlab> I'll do my best to be available! I don't get on here too much but if you @ me I'll notice it within a day or so. @Blacksmoke16 is always here though ;D
<FromGitter>
<grkek> coworkers are always busy
<FromGitter>
<grkek> and I am just left out alone
<FromGitter>
<Groogy> eh sounds like boring place to work
<FromGitter>
<Groogy> Programming chats at my place are always filled with people disagreeing which is the "proper way" to code C++
<FromGitter>
<tenebrousedge> the best way to code C++ is to write Crystal instead :D
<FromGitter>
<Groogy> If I only have it do the variant where it doesn't care about the return type it works perfectly fine
<FromGitter>
<Groogy> just the warning there
<FromGitter>
<dscottboggs_gitlab> oh wow thanks for the link @grkek I use kemal a lot and that might be a better way to organize my code
<FromGitter>
<Groogy> also it is not macro hell, it is beautiful in it's own special little way
<FromGitter>
<grkek> I mean macro hell for me to understand
<FromGitter>
<grkek> but it is beautiful
<FromGitter>
<grkek> since I am new to macros
<Yxhuvud>
groogy: I think macro expansions need to be self contained. ie, statements need to be contained in a macro, you can't do, eg part of a case statement inside a macro and part outside. All of it has to be in the macro, or none of it.
<FromGitter>
<Groogy> hmmm might be it
<FromGitter>
<grkek> also @dscottboggs_gitlab most of the dsl stuff is still there but yeah this will help you a lot
<FromGitter>
<grkek> thank you for the feedback
<FromGitter>
<Groogy> then I will need to do it with a ? : operator
<FromGitter>
<Groogy> somehow
<FromGitter>
<Groogy> I.e if Nop I want it to omit the ":" on the definition
<FromGitter>
<Blacksmoke16> bk
<FromGitter>
<grkek> also keep in mind that there is no performance hit what so ever since this does the same as the dsl used to do but it just keeps the whole package more organized and friendly
<Yxhuvud>
groogy: Can you use `Void` as a return type as a workaround?
<FromGitter>
<Blacksmoke16> unless you working with C bindings, `Nil` is the same
<FromGitter>
<Groogy> Well no it's a framework that's wrapping around your code, so I just want to mimick what you are doing.
<FromGitter>
<Groogy> If you wanna ignore the warnings, go ahead
<FromGitter>
<dscottboggs_gitlab> @Blacksmoke16 even in that case it's only a difference of convention
<FromGitter>
<Groogy> If I can get a stringliteral to be printed without the "" then I can make it work
<FromGitter>
<tenebrousedge> I want to ignore all the warnings. Full speed ahead! :D
<FromGitter>
<Blacksmoke16> @Groogy you can use `{% verbatim do %}`
<FromGitter>
<Blacksmoke16> then your macro code
<FromGitter>
<Blacksmoke16> then `{% end %}`
<FromGitter>
<Blacksmoke16> save from having to do `\{% ...` all the time
<FromGitter>
<Blacksmoke16> no need for if/else when the only thing that changes is the return type
<FromGitter>
<Blacksmoke16> good question, i think so?
<FromGitter>
<Blacksmoke16> verbatim is mainly helpful when using a macro within nested macro hooks
<FromGitter>
<Groogy> So when is types wanted as return type?
<FromGitter>
<Blacksmoke16> hm?
<FromGitter>
<dscottboggs_gitlab> (return) types are always inferred -- adding a restriction just produces a better error message if you make a mistake.
<FromGitter>
<Groogy> No I mean the warning I am getting
<FromGitter>
<dscottboggs_gitlab> oh
<FromGitter>
<Groogy> I want to satisfy it and trying to understand when return type is wanted
<FromGitter>
<Groogy> because it says it will become a future error
<FromGitter>
<Groogy> but does not say specifically what case
<FromGitter>
<Blacksmoke16> if you have a return type on an abstract def, the implementations of it must have the same or stricter return type
<FromGitter>
<Groogy> has anything with Shards and releases been changed?
<FromGitter>
<Groogy> or well you wouldn't know how long back this was for me so kind of dumb question
<Yxhuvud>
Uh, there was a release where they changed to a SAT based version resolver, but apart from that I havn't heard anything for a long time.
<FromGitter>
<Groogy> a SAT based version resolver?
<Yxhuvud>
basically upgrading all versions of everything to the globally best choice. Turns out to be NP complete in general. Basically what all modern package managers do, except for the one in Go.
<FromGitter>
<Groogy> alright cool
<FromGitter>
<Groogy> so then question becomes if it's 1.1.0 or 1.0.1 :D
<FromGitter>
<Groogy> in essence it's a patch but it sort of breaks things but is not any new features
<FromGitter>
<JohnLegrandRichards> Hey Guys! Looking to start contributing to Crystal. I read through the contribution guide. It told me I should maybe take a look at the newcomer label but those all seem to be handled. Anyone want to point me towards an Issue I could take a look at? Thanks!
<FromGitter>
<Blacksmoke16> best bet would be to just paruse the issues and see if there's anything you want to/can do
<Yxhuvud>
@JohnLegrandRichards: You could always look through the documentation and see if you can find something that needs improvements. That will teach you about the codebase and the process and perhaps give you an idea of what else might be feasible given what your skills have.
<FromGitter>
<Blacksmoke16> 👍
<FromGitter>
<Blacksmoke16> api doc improvements are always nice
<Yxhuvud>
what is really needed is more people knowing their way around the compiler, but the step to be productive there is pretty high
<FromGitter>
<Groogy> yeah so I am starting to suspect it is caused by the error that comes when I comment away that code
<FromGitter>
<Groogy> `Error: generic type too nested: Trashman::Record(Array(Trashman::Ref(Array(Trashman::Ref(Array(Trashman::Ref(Array(Trashman::Ref(Array(Trashman::Ref(Array(Trashman::Ref(Array(Trashman::Ref(Array(Trashman::Ref(Array(Trashman::Ref(Array(Trashman::Ref(Array(Trashman::Ref(Array(Trashman::Ref(Array(Trashman::Ref(Array(Trashman::Ref(Array(Trashman::Ref(Array(Trashman::Ref(Array(
<FromGitter>
<Groogy> if I can solve that then yeah it should work just dandy again
<FromGitter>
<Groogy> Can I somehow have it not do the included if `@type == Array(Trashman::*)`?
<FromGitter>
<Blacksmoke16> hm?
<FromGitter>
<Groogy> Well problem is I am including Trashman into Array, and the profiler is using Array itself, and would be nice if I could just have it not run the included macro on anything that belogns to the Trashman Module
<FromGitter>
<Groogy> including an Array with Trashman objects in it
wmoxam has joined #crystal-lang
<FromGitter>
<Blacksmoke16> hmm
<FromGitter>
<Groogy> Like something `{% Trashman.includes?(@type) || @type.generic_args.includes?(Trashman.types) %}`
<FromGitter>
<Blacksmoke16> converts it to a macro id
<FromGitter>
<dscottboggs_gitlab> > what is really needed is more people knowing their way around the compiler ⏎ ⏎ perhaps documenting the compiler would help with that 😒
<FromGitter>
<Groogy> I did try .id on it, didn't help