Is an imba Tag equivalent to a component?

I was looking through the documentation on Tags and noticed that the documentation uses a different naming convention for components than in the imba v1 examples I have seen. I.e. tag App becomes tag my-app, likewise the section in the docs is titled tags components rather than just tags as in the old docs.

I’m wondering if a tag is truly analogous to a component? Could I describe it as such to a front-end developer who I was introducing to imba? If they are analogous, why do we call components ‘tags’ instead of ‘components’?

I assume that this change is being made to make imba more compatible with the rest of the front end ecosystem, perhaps this makes it less surprising and more intuitive to developers with front end experience, but was surprised by the transition away from a more Ruby style towards a traditional javascript convention.

As a follow-up question, is the imba naming convention going to exactly mirror that of javascript? it seems to be so far but it would be nice to know if that was the guiding principle or just how it ended up!

The tag my-app convention is due to the fact that Imba 2 now compiles down to native web-components, and it thus follows the same naming convention as that of web-components.

In Imba 1, I would say that tag is just shorthand for component. I would describe it as such. Maybe @somebee or @scanf can testify to this better. The term tag is applicable as your components will be accessed through a custom <Tag> instead of native <html> tags via id’s or classes.

In Imba 2, as stated above, tags are literally compiled to web-components, so it’s a bit more specific.

To my understanding, Imba aims to make javascript web app development more streamlined. It combines a fun syntax inspired by Ruby, with the javascript runtime to create highly performant web apps that are fun to code. For your followup question, I’m not sure what naming convention you are referring to. The component naming-convention?

1 Like

Hey Eric, thanks for the great response, I see what you mean-- in the context of Imba v2 it is a lot more obvious most of my work so far as been in imba v1 so I hadn’t seen tags being actual objects.

As for the second part of my question, I was refering to naming convention in general: functions, calsses, variables, components. It seems as though we are always using the javascript naming conventions-- I assume because that will produce the neatest code when we have projects incorperating both imba and javascript code. I am just wondering if this was a general rule I could follow (I.E. If i don’t know the conventions for naming files, can I look up how they are named in javascript and be safe?)

I see.

Imba doesn’t strictly enforce a naming convention for other than tags as far as i know. Though I’m not sure if that is changing with Imba2. You could probably use different naming conventions, but it is probably a good idea to follow as many JS naming conventions for your own sanity. In the end, Imba will compile down to a JS application anyways, and your naming conventions should carry through.

So i believe that all JS naming conventions are advised in Imba, and at the very least, they are supported.

@Somebee is this correct?

1 Like