Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
No, T is the perfect name for a generic type variable when you only have one variable type.
-
100% agree it's dumb, but in a single instance we have been "educated" to tolerate it due to many many brainwashing examples using it.
Same goes for "i" in a for loop.
But as soon as there's 2 or more, I always go for meaningful name like Fragment<VIEW, MODEL> and avoid Fragmet<T, V> crap -
@LordPeeve same. The linter is set up to warn about identifier names with less than 3 characters, with some exceptions like "in" or "at" that are commonly used for function parameter names (or labels).
I’ve also put T into the whitelist for generic type parameters but I rarely use it because you can almost always come up with a better name.
Like List<Element>.
I use T when the generic type literally means any type. Like for deserialization. -
Jedidja10143y@Oktokolo I completely forgot about that generic thing.
In the codebase I started working on T is used for an array of transformation matrices -
@Lensflare 💯
I may have been guilty of using T for less than fully basic object type but in my defense I was young and it achieved brevity (e. g. <T : Animal>).
I'm still being told I'm too picky when I ask teammates to change it in their pull requests 🙄 -
I use T for generic types because that's also how it's done in all the .NET framework source.
If there are multiple types then I make it more descriptive.
can we agree that T is a dumb variable name?
I mean I totally know what it means in that instance, but why do people keep writing math stuff like they'd skribble it on paper?
rant
fucking electricians