<FromGitter>
<neutrinog> this is the expected output
<FromGitter>
<grkek> which instead of outputting true outputs the actual class which included the Serializable module
<FromGitter>
<neutrinog> is_a? always returns a boolean. I was manually printing the class in the first version of the code you saw.
ur5us has quit [Ping timeout: 252 seconds]
<FromGitter>
<grkek> Put ```puts {{ ivar.is_a?(Serializable) }}``` after the line 14 where the loop starts and spec your app.
rohitpaulk has joined #crystal-lang
ur5us has joined #crystal-lang
<FromGitter>
<neutrinog> that gives the same result. I did realize this works `puts @{{ivar}}.is_a?(Serializable)` however i want to store it in a macro variable.
rohitpaulk has quit [Ping timeout: 256 seconds]
rohitpaulk has joined #crystal-lang
<FromGitter>
<xss2bruh> I want to suggest a universal comment that works in all programming languages
<FromGitter>
<xss2bruh> please share this
<FromGitter>
<neutrinog> @grkek I figured it out `Serializable.includers.any? { |t| t == ivar.type }`. thanks for taking a look at my code.
<FromGitter>
<grkek> go ahead @xss2bruh
<FromGitter>
<grkek> Oh damn @neutrinog I love macros but they hate me
Human_G33k has joined #crystal-lang
HumanGeek has quit [Ping timeout: 256 seconds]
<FromGitter>
<j8r> universal comment? @xss2bruh
<FromGitter>
<xss2bruh> yes
<FromGitter>
<xss2bruh> for every programming language
<FromGitter>
<xss2bruh> maybe it's more convenient for others
<FromGitter>
<grkek> @xss2bruh stop being weird
<FromGitter>
<grkek> and say it already
<FromGitter>
<xss2bruh> oh
<FromGitter>
<xss2bruh> sry for being weird
<FromGitter>
<grkek> no you are not being weird I just joked around
<FromGitter>
<grkek> send us your idea
<FromGitter>
<xss2bruh> ok
<FromGitter>
<xss2bruh> so
<FromGitter>
<xss2bruh> should I start a chatroom somewhere
<FromGitter>
<j8r> We still don't know what is the proposal...
<FromGitter>
<j8r> It is not even explained in the issue
<FromGitter>
<xss2bruh> so
<FromGitter>
<xss2bruh> I am trying to convince devs to make a universal comment that works in any language
<FromGitter>
<xss2bruh> It may help ppl
<FromGitter>
<j8r> code comments?
<FromGitter>
<j8r> What do you mean by universal?
<FromGitter>
<xss2bruh> yes
<FromGitter>
<xss2bruh> universal = works in all programming language
<FromGitter>
<xss2bruh> languages*
<FromGitter>
<xss2bruh> yes, code comments
<FromGitter>
<j8r> that's just the sign indicating the comment, like `#` or `//`?
<FromGitter>
<j8r> what do we have to change?
<FromGitter>
<xss2bruh> these signs don t act as comments in all programming languages
ur5us has quit [Ping timeout: 256 seconds]
<FromGitter>
<xss2bruh> for example `#` is not a comment in markdown
<FromGitter>
<xss2bruh> it makes titles(headers)
<FromGitter>
<xss2bruh> they're `<h3>` tags
<FromGitter>
<xss2bruh> so my idea
<FromGitter>
<xss2bruh> is that we make a combination of simbols that work as a comment in every(a lot) programming language
<FromGitter>
<xss2bruh> I provided a link, if someone want's to join
rohitpaulk has quit [Ping timeout: 256 seconds]
<FromGitter>
<j8r> it won't be possible
<FromGitter>
<j8r> for example `//` is floor division, `1 // 2` is an expression whereas in JS `2` is a comment
<FromGitter>
<j8r> any combination of `#` and `//` won't work without changing the language
<FromGitter>
<alex-lairan> Why `//` should be a comment? ⏎ I think that comment should be `#// My comment` thank this everyone will be disappointed. :D
<FromGitter>
<j8r> `1 #// 2` in crystal, the comment is `// 2` ⏎ In JS, the comment is `2` - and I think `1 #` as an expression is not valid
<FromGitter>
<xss2bruh> we will try something else
<FromGitter>
<alehander92> @xss2bruh it's very hard to do something like this
<FromGitter>
<alehander92> you probably know some languages use `;`, some other symbols etc
<FromGitter>
<alehander92> i can see the usefulness, but many editors already have a shortcut for that
deavmi has quit [Ping timeout: 256 seconds]
deavmi has joined #crystal-lang
deavmi has quit [Client Quit]
deavmi has joined #crystal-lang
Human_G33k has quit [Ping timeout: 258 seconds]
<FromGitter>
<neutrinog> @Blacksmoke16 yes. That got me most of the way. Then I was stuck until I figured out how to manually check types in macros. Everything thing is working now. In case anyone cares, I'm building a serializer that will be used to map crystal classes to uniforms in glsl programs (vertex and fragment shaders).
<FromGitter>
<neutrinog> All that for a 3d rendering library I'm building.
<FromGitter>
<Blacksmoke16> 👍
<FromGitter>
<Blacksmoke16> do they use a specific format or something?
<FromGitter>
<neutrinog> not really. But I'm trying to abstract everything so it's easy to support custom shaders. The flow of logic is sort of like this: A developer creates a new class such as "SpotLight" that registers the file path to a glsl program, and annotates instance variables that will be bound to the glsl program. A shader class then does all the heavy lifting to bind values to the glsl program.
<FromGitter>
<neutrinog> In other words, this will abstract away all of the OpenGL language. So adding a new shader with fancy lighting effects just requires a new crystal class.
<FromGitter>
<Blacksmoke16> gotcha
<FromGitter>
<xss2bruh> maybe I will try to make a package that will do the thing
<FromGitter>
<Blacksmoke16> what thing?
<FromGitter>
<xss2bruh> oh
<FromGitter>
<xss2bruh> sry
<FromGitter>
<xss2bruh> a universal type of comment that works in every programming language
<FromGitter>
<Blacksmoke16> generally, or for documentation?
<FromGitter>
<xss2bruh> it may be useful fo ppls
<FromGitter>
<xss2bruh> what do you mean?
<FromGitter>
<xss2bruh> sry
<FromGitter>
<Blacksmoke16> like just for adding comments in your code, or like special comments used to document it like https://jsdoc.app/tags-returns.html
_ht has quit [Remote host closed the connection]
_ht has joined #crystal-lang
deavmi has quit [Quit: Going into the wilderness...]
<FromGitter>
<manveru> is there any way to make `crystal tool format` more opinionated about line lengths and not preserving newlines at all cost?
<FromGitter>
<Blacksmoke16> i.e. set a limit on line length?
<FromGitter>
<manveru> yeah
<FromGitter>
<Blacksmoke16> the point of the format tool is to provide a common format all projects can use. if customization is allowed then it defats the purpose
<FromGitter>
<Blacksmoke16> ameba supports that iirc tho
<FromGitter>
<manveru> well, if it would completely discard the existing formatting, i'd agree, but it obviously doesn't :)
<FromGitter>
<manveru> so i still have to manually adjust stuff... i just want a unified format, not options really
<FromGitter>
<manveru> guess i'll have to wait until someone writes this is a new tool then
deavmi has quit [Ping timeout: 265 seconds]
<FromGitter>
<kinxer> @manveru I'll admit, I don't *love* the phrasing "a formatter that reduces creative freedom to a minimum". :P
<FromGitter>
<manveru> but it's exactly what I want, I really love this part about Mint, Elm, and JS, never spend a second thinking about formatting :)
<FromGitter>
<manveru> and while crystal is better about it than ruby+rubocop already, it's still neither making everyones code look consistent, nor configurable enough to allow for it
<FromGitter>
<kinxer> Yeah, I believe that it's what you want, and I think I understand the reasoning for it. I just want to be a *person* when I'm coding, not only a productive agent.
<FromGitter>
<kinxer> I know that's not an optimally efficient way to work on software, though, especially in an organization.
<FromGitter>
<manveru> yeah, I've introduced Crystal to people in my team, and they write stuff with it, but it's just a lot of work to clean up after them :)
<FromGitter>
<kinxer> That's fair. The few people in my office who use Crystal have a style guide we use, but having an automatic tool (to supplement `crystal format` or perhaps some way to configure it) would be nice.
<FromGitter>
<Blacksmoke16> ameba can help identify some stuff, but fixing it would have to be manual atm
<FromGitter>
<kinxer> I guess I understand the desire to have formatting be consistent over the entire language, but actual people (and therefore organizations) differ as to what specifics they believe make code more maintainable.
<FromGitter>
<kinxer> For example, the small group of Crystal programmers I work with decided that ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ makes sense for method calls with long arguments or long argument names. [https://gitter.im/crystal-lang/crystal?at=5e87aa8d50a27d11c7e91731]
<FromGitter>
<Blacksmoke16> i tend to agree
<FromGitter>
<kinxer> But not everyone needs to agree about that.
<FromGitter>
<kinxer> I personally tend to use lots of vertical whitespace in my code to separate "logical sections" (arguably, refactoring to methods would be better in some cases...), but not everyone works that way.
<FromGitter>
<stronny> I think Ruby is built in such a way that makes a unviersal style guide impossible
<FromGitter>
<manveru> i guess after 15 years of ruby, i just don't think of code formatting as creative anymore... it's just a chore at this point :P
<FromGitter>
<stronny> do you have a separate fomatting stage?
<FromGitter>
<manveru> stage?
<FromGitter>
<stronny> I don't look at this as some distinct entity called "formatting"
deavmi has joined #crystal-lang
<FromGitter>
<manveru> ah, yeah
<FromGitter>
<stronny> the way code looks is the result of author's thought and expression
<FromGitter>
<stronny> anyway, I often dislike other people's code, and by the same token do not require from others any favors from mine
<FromGitter>
<stronny> you do you, I'm gonna do me, win-win
<FromGitter>
<manveru> i really don't think much about formatting while writing code, it formats on save, but in crystal i have to go through everything i wrote and make it look consistent again.
<FromGitter>
<manveru> just the fact that we're talking about this is already a waste of time really... didn't want to drag it out that much, sorry
<FromGitter>
<stronny> well I care a lot about how my code looks. I'm that guy that idents with tabs and strips trailing spaces and aligns everthting just right
<FromGitter>
<stronny> I don't mind some talk really, but okay
<FromGitter>
<kinxer> "Indents with tabs" D:
<FromGitter>
<kinxer> :P
rohitpaulk has joined #crystal-lang
<FromGitter>
<kinxer> That is a nice example, though. It works for some people and not for others.
<FromGitter>
<stronny> yep
rohitpaulk has quit [Ping timeout: 265 seconds]
ur5us has joined #crystal-lang
<FromGitter>
<robacarp> man I wish more people used tabs
<FromGitter>
<robacarp> only because I can't stand to look at code that's indented with 4 spaces