2 ms·
In Canvas, I’d still prefer to inline everything, but I recognise that you’re getting to the scale where it’s more debatable—that it’s not just unquestionably s
by chrismorgan 2y ago
In Canvas, I’d still prefer to inline everything, but I recognise that you’re getting to the scale where it’s more debatable—that it’s not just unquestionably superior, as it is in the smaller cases like this. (You “decided to keep it as is for readability”? I’m confused; I find the way you wrote it vastly less readable, it’s not even close.)
When you don’t inline the methods, really all that you get out of it is a list of properties, without the method bodies getting in the way. The question then is, is that useful? If you’re in a simple text editor, then sometimes definitely yes. But it’s duplication, it’s more scope for mistakes, and all up there’s a reason why things like C headers have been falling out of favour as an authoring style. More advanced editors these days can present file outlines, which will work pretty well with the function style, and would work even better with class methods, but may not work so well with the inlined object-shorthand methods (I don’t know, I’m not in the habit of using such outliners—it’s possible for them to take these methods, but it wouldn’t surprise me to find them omitting them altogether).
It’s a similar deal to whether you write `export function a… export function b…` or `function a… function b… export {a, b}`. Some prefer one, some the other. Sometimes there are compelling reasons to use one or the other, independent of preference. I get the feeling immediate export is more popular.