<FromGitter>
<aboeglin> I'm getting into crystal, and I see a lot of @ symbols in the code I read but I just can't seem to google it .. Anyone could tell me what it does, or how it's called so I could search for it properly ?
<FromGitter>
<aboeglin> It may be important to say I have no prior knowledge of ruby
<FromGitter>
<bew> Did you read the Crystal docs?
<FromGitter>
<aboeglin> Yes I have
<FromGitter>
<bew> Basically `@instance_variable`, and `@@class_variable`
<FromGitter>
<aboeglin> not everything though, but I've read quite a bit of it already
Groogy1 has quit [Ping timeout: 252 seconds]
<FromGitter>
<bew> What exactly you don't understand?
<FromGitter>
<aboeglin> alright, so it's a self or this
<FromGitter>
<aboeglin> well, now I'm good
<FromGitter>
<aboeglin> well, I just saw it everywhere on the code I was reading, but couldn't figure what it was
<FromGitter>
<bew> Kindof, it's the way to directly access the attributes
<FromGitter>
<bew> What language are you used to?
<FromGitter>
<aboeglin> just try to google "@ crystal" you'll see what I mean
<FromGitter>
<bew> Lol ^^
<FromGitter>
<aboeglin> python js php C++ java mostly
<FromGitter>
<aboeglin> and a class variable from outside would be Class::variable_or_method right ?
<FromGitter>
<aboeglin> except if it's private or protected obviously
<FromGitter>
<aboeglin> I have done a whole bunch of hyped functional programming lately. I'll need to put myself back in an OO mindset to be proficient in crystal I suppose.
<FromGitter>
<bew> Ahah yes, Crystal is OO everywhere
<FromGitter>
<aboeglin> Yes, that's the part of the documentation I have skipped for now, that may explain it ^^
<FromGitter>
<aboeglin> From what I understand, even a module is a sort of class
<FromGitter>
<bew> Indeed...
<FromGitter>
<bew> not in crystal terms, what do you mean by that?
<FromGitter>
<aboeglin> that you can't instantiate though, so per see there's no "function", it's all methods right ?
<FromGitter>
<bew> yes
<FromGitter>
<aboeglin> when we use the keyword include
<FromGitter>
<fenicks> Hi everyone
<FromGitter>
<bew> hi @fenicks
<FromGitter>
<aboeglin> somehow we just assign the static method of another module to the current one
<FromGitter>
<aboeglin> Hi @fenicks
<FromGitter>
<aboeglin> From what I understand though, anyways, @ and @@ were the bigger blockers to understand the code I was reading, I'll go back to my actual job for now, but I enjoy crystal a lot ! I'll rewrite a small service with kemal this week for sure :D
<FromGitter>
<aboeglin> Thanks for the answers !
<FromGitter>
<bew> cool @aboeglin, welcome to Crystal :D
Groogy1 has joined #crystal-lang
<jokke>
if i have a named tuple _instance_ like this: `{ foo: Foo, bar: Bar }` (not a declaration). how can i strip the `.class` from the values in a macro context? So i have a method `foo(**args : **T) forall T` and i want to access `T[:foo]` and use it to create an instance of the passed class.
<FromGitter>
<vladfaust> I'm not sure if instances are available at compilation :thinking:
<FromGitter>
<straight-shoota> jokke, where do you get the `.class` from in the first place?
return0e has quit [Remote host closed the connection]
moei has quit [Ping timeout: 252 seconds]
return0e has joined #crystal-lang
Groogy1 has quit [Quit: WeeChat 2.2]
<jokke>
straight-shoota: it's there as soon as i call `foo(foo: Foo)`
<FromGitter>
<fusillicode_twitter> @vladfaust sorry for the bother but I was wondering if `Validations` has a `presence` validation 🤔
<FromGitter>
<fusillicode_twitter> I mean If I have a Struct with optional strings
<FromGitter>
<vladfaust> @fusillicode_twitter currently there is no `presense` validation, but you could easily add your own rule. I guess it's pretty common rule, so I'll create an issue
<FromGitter>
<fusillicode_twitter> > Whom do I write docs for?! http://github.vladfaust.com/validations.cr/ ⏎ Sorry I didn't mean to bother you, and I think that I've written down the question wrong :(
<FromGitter>
<fusillicode_twitter> Sorry I didn't mean to bother you, and I think that I've written down the question wrong :(
<FromGitter>
<fusillicode_twitter> It is clear how to add custom validations
<FromGitter>
<vladfaust> No offence!
<FromGitter>
<vladfaust> I'm not bothered, I enjoy people using my shards
<FromGitter>
<vladfaust> However, I spend like 30% of the time writing exhaustive API docs
<FromGitter>
<fusillicode_twitter> Believe me it is a well documented shard and I really liked it
<FromGitter>
<fusillicode_twitter> > However, I spend like 30% of the time writing exhaustive API docs
<FromGitter>
<fusillicode_twitter> I also feel that the docs are comprehensive and very good written
<FromGitter>
<fusillicode_twitter> Btw I also understand if you were bothered. It's an understandable feeling :)
<FromGitter>
<fusillicode_twitter> In any case let me apologize for my lack of accuracy, next time I'll take a better look also at the marco section :)
<FromGitter>
<fusillicode_twitter> 🙇
<FromGitter>
<vladfaust> Oh man, no need to be such polite (with me at least)
<FromGitter>
<fusillicode_twitter> lol that's how I am buddy, sorry even for this XD
<FromGitter>
<fusillicode_twitter> 🍻
<FromGitter>
<vladfaust> I'm interested in people using my shards, so I'm here to help. Sorry if I look too aggressive, that's just my honesty
<FromGitter>
<vladfaust> I suffer from this a lot!
<FromGitter>
<vladfaust> We, Russians, don't like that "smile at first"
<FromGitter>
<vladfaust> We rather be grumpy at first and really smile to friends only
<FromGitter>
<fusillicode_twitter> lol XD
<FromGitter>
<vladfaust> And I hate lies more than anything, that's really the reason why modern world sucks
<FromGitter>
<fusillicode_twitter> totally agree
<FromGitter>
<vladfaust> Pretending to be polite is a lie for me, so if I feel that I need to say something, I'll say it, like it you or not
<FromGitter>
<vladfaust> Actually, that drives me away from society, but it makes me respect myself
<FromGitter>
<vladfaust> Honor - that a thing the modern humanity lacks of. IMO, of course
<FromGitter>
<fusillicode_twitter> 👎
moei has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 250 seconds]
moei has quit [Quit: Leaving...]
moei has joined #crystal-lang
akaiiro has joined #crystal-lang
<FromGitter>
<Blacksmoke16> @sdogruyol great, ill check it out. thanks
sevensidedmarble has quit [Remote host closed the connection]
DTZUZO_ has quit [Ping timeout: 272 seconds]
DTZUZO_ has joined #crystal-lang
<FromGitter>
<alehander42> politeness is just a custom behavior protocol, not necesarrily better or worse than the others :D
<FromGitter>
<fusillicode_twitter> wise words @alehander42 :)
<FromGitter>
<paulcsmith> I agree. I think the best option is to adjust to the person you are speaking too. Some people prefer politeness. Some prefer directness. Always with respect though :)
<FromGitter>
<j8r> Even if we aren't polite, everyone will agree to not insult, at least :)
<FromGitter>
<alehander42> i like honesty tho, otherwise agree :D
<FromGitter>
<fusillicode_twitter> I think that at the end we're all aligned :)
<FromGitter>
<fusillicode_twitter> Btw @j8r there was absolutely no insult whatsoever
<FromGitter>
<fusillicode_twitter> Just to clarify ;)
<FromGitter>
<j8r> for sure, not anymore, damn 😄
<FromGitter>
<j8r> (not really one btw)
<FromGitter>
<j8r> is it possible to politely insult?
<FromGitter>
<fusillicode_twitter> lol XD
<FromGitter>
<paulcsmith> Yep! You just add "no offense" at the end :P
<FromGitter>
<j8r> haha, along with "Sir"
<FromGitter>
<j8r> other topic, how can I spec a block that never returns?
<FromGitter>
<j8r> I can't `break` inside the block
Creatornator has joined #crystal-lang
<FromGitter>
<j8r> With channels we ca do, but else `.should eq` returns weird outputs if it fails
<FromGitter>
<HarrisonB> Run it with a timeout? :P
<FromGitter>
<j8r> how can I do @HarrisonB ? (Not the block in question has a `sleep 0.1` inside)
<FromGitter>
<j8r> else another solution is to only test non yielding variants
<FromGitter>
<j8r> yeaahhh it works with channels :)
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter>
<HarrisonB> @j8r so you got a spec working?
<FromGitter>
<fusillicode_twitter> Quick question, is there a "facility" to convert a Struct into a named tuple or into another Struct 🤔
<FromGitter>
<vladfaust> Convert struct into another Struct? I think that's too specific
<FromGitter>
<fusillicode_twitter> Yes you're right but I had recently the same need in Scala and I found something
greengriminal has quit [Quit: This computer has gone to sleep]
Creatornator has joined #crystal-lang
<FromGitter>
<cheezy085_gitlab> hey, you guys got any discord server?
<FromGitter>
<r00ster91> no currently there's unfortunately no official discord server. But there's a channel for crystal on The Coding Den: discord.gg/code
<FromGitter>
<fridgerator> The core team prefers to stick with irc and gitter
<FromGitter>
<j8r> and a good chunk of us to :)
Heaven31415 has joined #crystal-lang
<FromGitter>
<fusillicode_twitter> > and a good chunk of us to :)
<FromGitter>
<fusillicode_twitter> #truestory ;)
<FromGitter>
<fusillicode_twitter> oh gosh...
<FromGitter>
<fusillicode_twitter> #... -. -
<FromGitter>
<j8r> you tried hash tag?
<Heaven31415>
Hi
<FromGitter>
<fusillicode_twitter> -.-
<FromGitter>
<fusillicode_twitter> @j8r oh yeah...and I end up like a spammer...