this post was submitted on 22 Jul 2023
2 points (100.0% liked)

English usage and grammar

364 readers
1 users here now

A community to discuss and ask questions about English usage and grammar.

If your post refers to a specific English variant, please indicate it within square brackets (for instance [Canadian]).

Online resources:

Sibling communities:

Rules of conduct:

The usual ones on Lemmy and Mastodon.. In short: be kind or at least respectful, no offensive language, no harassment, no spam.

(Icon: entry "English" in the Oxford English Dictionary, 1933. Banner: page from Chaucer's "The Wife of Bath's Tale".)

founded 1 year ago
MODERATORS
 

I’m a computer programmer. When we test programs, we often use a function called “assert” to check if the program produces the conditions we expect.

For example, this test will fail if the + produces an incorrect result:

assert( 2 + 3 ).equals(5)

Another meaning of “assert” in programming is “check, and take action, if necessary”. For instance, the procedure assertDataPresent() may check if the data has already been loaded. If it hasn’t, the function would try to do so, so that in either case the data is present after the procedure is executed.

Which of these meanings is the more common one in regular English? Can “assert” even be used in these ways outside programming?

top 1 comments
sorted by: hot top controversial new old
[–] pglpm@lemmy.ca 1 points 1 year ago* (last edited 1 year ago)

According to the Cambridge dictionary and to the Merriam-Webster dictionary, "assert" means "to say that something is certainly true". The Oxford dictionary gives a similar definition among others:

III. To declare, state.

7 trans. To declare formally and distinctly, to state positively, aver, affirm.

So to me it sounds strange to use it as "to check". I haven't seen a definition similar to "to check" in the three dictionaries above. I didn't know it was used this way in programming.

Edit: my understanding of the programming term was wrong, see other comments.