Victor

@victorz@lemmy.world · Joined ⁨Nov⁩ ⁨2023⁩

Replying to @⁨luthis@lemmy.nz⁩

My language does that, as well as English in which I am fluent. I still find type-first to be impractical.

Also when you write the code, you are usually looking to create a variable, so maybe you type “var” or “const”, right, then you have a contextual name in mind, maybe salary. Then you can make a decision, which type it should be. Maybe “whole dollars”? “Dollars in a decimal number”? Or it could be a complex type in other contexts.

That’s how I prefer to write code. 👍

Maybe it makes more sense to someone who knows more than one language as well, e.g. languages that use a noun-adjective structure, like French, or Farsi. I don’t know. But for me it’s not about language, it’s about practicality. Findability and writability, if those can be considered words, lol.

Replying to @⁨Joelk111@lemmy.world⁩

I learned Java first. I think type should come second as well, like in TypeScript et al.

If you’re ever looking for the variable manually for some reason, by searching with your eyes, it’s easier to find it by searching in the first character column.

Otherwise, if you ever need to see the type of something, which… should be obvious from the context in quality code, your LSP should just be able to tell you directly, by some mechanism (hover with mouse, or some keyboard action).