Thursday, 5 November 2015

grammaticality - Past tense of “to cast” in the programming sense

At issue here is the fact that programmers often find it beneficial to deliberately go against what would generally be good style.



We mix dialects to match keywords and member names (e.g. those of us who have a dialect in which the spelling is colour will use color to refer to the codes that represent colours and the methods that act upon them), we bastardise orthography to match the legacy of technical limitations of earlier systems (it's traditional to implement façade patterns with facade objects, though there's no good reason for that with modern languages), we mess with typography so that I might say "The method takes two ints and returns another", switching font-style mid-word.



And as such, we do some pretty strange things, due to the fact that we are using English to describe a form of expression that is not English but which does often use English words.



But some of us can also speak and write English reasonably well, so unless we've a reason for writing "close" to the style of a program, we won't. E.g. we'll say int in some contexts and integer in others.



In those contexts where one isn't directly mirroring a given language syntax (including those cases where the language one uses doesn't have a cast keyword, method or function involved in its approach to casting), I would certainly expect cast, rather than casted.



In those contexts where one does, I personally only abuse normal English if it's impossible to do so without altering the word that appears in the code. E.g. if I had a goose class I'd refer to them as gooses because geese changes the word used in the code, but I'd use children rather than childs. Other coders differ in how far they'll do violence to the code or to plain English.



As such, I'd use cast even if there was a cast keyword or function name, like in SQL. Those programmers more prepared to go further from normal English than I am may or may not (there isn't really a need to).



In all, I'd expect to see some people use casted though I wouldn't myself, because it would be in a context where bending the normal rules has a value that makes it worth doing.



And I'd also expect some people to just use it anyway; some people do in the other senses of the word, and while it sounds awkward to me (even though it passes my normal "good enough for Shakespeare, good enough for me" test), there have been lots of other cases where -ed forms of the past tense grew upon verbs that once hadn't had them before, so I wouldn't complain too loudly.



All of which doesn't really give a very firm answer, but then once you're breaking the rules as programmers do with our jargon, you're not going to have a clear rule any more, by definition. I'd summarise as "no, except when they do" and a personal recommendation to use cast oneself.

No comments:

Post a Comment