Half hearted _Bool

K

Keith Thompson

Nick said:
Keith Thompson said:
Tim Rentsch said:
[...]
The usage in "implicit cast" isn't incorrect.
[...]

Yes, it is.

I'll say that a different way. It's accepted under regular informal
English (even with 'cast' having its usual technical meaning). People
might object to it as being technically bogus, or technically stupid,
or whatever, and technically they're probably right; however it is
still perfectly acceptable as informal English.

It's accepted in the same way that "irregardless" is accepted.

The term "implicit cast" *only* applies to C, so arguments about regular
informal English don't really apply; 99% of English speakers probably
don't know what a "cast" is in this context.

You seem to be making an artificial distinction between "technically
right" and "right". I don't agree that there is such a distinction.

I think the distinction to be drawn here is /not/ between technical and
common English, but between C Standardese and technical computer talk.
No wonder it's lead to a lot of normally sensible people digging
themselves holes from which to throw things at each other.

There term "cast" exists outside C but in the world of programming
languages, to mean turning one sort of value into another.

For example, you'll get plenty of hits on a search for "cast in python",
"cast in SQL", "cast in javascript" etc.

SQL apparently has a built-in function called "CAST", which performs
some kind of type conversion (this is the result of about 30 seconds
with Google; I don't know the details). Since it's actually the
name of a built-in function, using the word "cast" to refer to an
implicit conversion would be even more confusing in SQL than in C.

The first few Google hits for "cast in python" and "cast in
javascript" seen to be either people asking how to do it or people
explaining that there's no such thing (e.g., "Why would you type
cast in Javascript? Do you mean coercion?").

The Wikipedia article on type conversion also seems to say that
the term "cast" applies only to an explicit conversion. (Yes,
Wikipedia should be taken with a grain of salt, but at least in
this case it agrees with my own experience.)

My best guess is that the use of the term "cast" to mean "conversion"
originated with Algol 68.
Not all languages do it by putting a type name in brackets. And at
different times different languages need to be told to do it, or do it
automatically.

So there are things that can sensibly be called "implicit casts" and
"explicit casts". It just happens that, in the C standard, "implicit
casts" are called "conversions" and "explicit casts" are called "casts"
(I think). It's not that surprising that people who talk lots of
languages occasionally use the broader, but still technical, term rather
than the peculiar to C one.

I could be wrong, but my impression is that most people who use the
term "implicit cast" aren't basing the usage on their knowledge
of other languages, or of computer science in general, but on a
(quite understandable) confusion between the operator and the
operation that it specifies.

I've used a fair number of languages, and dabbled in quite a few
more. I've never seen one that uses the term "cast" to refer to
an implicit conversion. That's not to say that there are no such
languages, of course.

When the C standard and most or all C references provide a clear
and unambiguous meaning for a word, I suggest that it is unwise
to weaken the meaning of that word by using it sloppily, unless
there's a very good reason to do so.
 
V

Vincenzo Mercuri

sandeep said:
instead of the new _Bool (which has implicit casts to and from int, so
there would be no incompatability with existing code)

The more articles I read the more I get convinced that the
ambiguity in the idiom "implicit cast" comes from the different
connotations we assign to "implicit": an /adjective/ (as syntactically
is in the idiom), and an /adverb/ (as actually many think about it).
What we all agree on is that we mean:

* a /cast/ at a second stage under the woods
of the Standard Library implementation *

switch...case *adjective* :
--------------------------------------
To express this concept using the adjective
'implicit' is definitely not a happy choice,
since we are dealing with very technical words
and the meaning of the words implicit and explicit
cannot be put in doubts. The word /cast/
cannot be given any qualifier. If any, it leads
to nonsense: 'implicit explicit conversion' in this case;


switch...case *adverb* :
--------------------------------------
Actually I think it would have been better
to say: '.., implicitly, _Bool has a cast....'
Here the example of (void *) - see Seebs' article -
effectively fits.
This might have led to many less objections,
since 'implicitly' is a mere meaningful gift
from people language;



break;
 
S

Seebs

Therefore, like "Microsoft Works" or "military intelligence", the phrase
"inedible food" is oxymoronic, and oxymorons (self-contradictory
expressions) are rarely of much use in establishing the truth of a
logical argument.

They can be, in some cases, a good way to communicate something tersely.
The problem, of course, is that the disambiguation is not particularly
guaranteed to be reliable. I think they're more useful in non-technical
fields, where connotations are more important and precision is less
important.

-s
 
T

Tim Rentsch

Keith Thompson said:
Tim Rentsch said:
Keith Thompson said:
[...]
The usage in "implicit cast" isn't incorrect.
[...]

Yes, it is.

I'll say that a different way. It's accepted under regular informal
English (even with 'cast' having its usual technical meaning). People
might object to it as being technically bogus, or technically stupid,
or whatever, and technically they're probably right; however it is
still perfectly acceptable as informal English.

It's accepted in the same way that "irregardless" is accepted.

I would say the two cases are different. The word 'irregardless'
is an invented word, apparently appearing for the first time in
the early 20th century. In the phrase 'implicit cast', both
'implicit' and 'cast' are used in their normal senses. The
combination doesn't make literal sense, so at best the meaning of
such a phrase is idiomatic (and please note that I do _not_ mean
it's a standard idiom). However, it's easy to guess a meaning
that makes a sort of sense despite the apparent inconsistency of
the combination. In informal English these kinds of "irregular
meanings" and verbal shorthands happen all the time. A person
who uses "irregardless" just means a different word (although
whether the different word is "regardless" or "irrespective" we
don't always know). A person who uses the phrase "implicit cast"
means (in most cases) something different from "conversion" or
"cast", and also _for which there is no convenient existing word or
phrase_. My point isn't that the phrase is well-defined, indeed
it is not; rather, the construction that goes on to produce such
a phrase is commonly accepted in informal English. An example is
"deafening silence": literally this term makes no sense, yet the
combination can be understood (and has come to be understood) as
having a meaning different from the literal meaning of its
constitutent words. The construction began as being idiomatic;
over time and with greater usage the idiomatic phrase became a
standard idiom.
The term "implicit cast" *only* applies to C, so arguments about regular
informal English don't really apply; 99% of English speakers probably
don't know what a "cast" is in this context.

This statement presumes that "informal English" automatically implies
"non-technical English". That's a bad presumption: there is both
"formal technical English" and "informal technical English" (and also
the other two combinations). Formality and technicality (if I may be
allowed a little frivolous wordplay) are orthogonal aspects.
You seem to be making an artificial distinction between "technically
right" and "right". I don't agree that there is such a distinction.

I'm not saying -- more accurately, what I mean to be saying is not --
that 'implicit cast' as a phrase is either "right" or "technically
right"; rather it is that the construction is acceptable in informal
language. Is it the best phrase to convey what the speaker wants to
convey? That's impossible to say, because the phrase doesn't have a
well-defined meaning, nor do we know exactly what it is that the
speaker wants to convey (and indeed the speaker himself may not know
that exactly either). Despite that, the phrase may be successful
at conveying something of the intended meaning, and that process
works well enough so that similar sorts of phrasings are commonly
accepted in informal speech or writing.
And if the person is using words in a technically *imprecise* (i.e.,
wrong) way, he's likely to use a phrase like "implicit cast".

Imprecise is not the same as wrong. If I say the acceleration due
to Earth's gravity is 32 feet/second/second, that's a somewhat
imprecise statement, but it isn't necessarily a wrong statement;
whether it's right or wrong depends on what you think the error
bars are. Generally speaking, using informal language tends to
widen the error bars; indeed, not just widen, but also expand
their dimensionality outside the usual numerical dimensions and
into some linguistic dimensions.
So what's wrong with pointing out that "conversion" is a better and more
correct way to express the concept that was being expressed?

What's wrong is that it assumes that "conversion" (in the same
sense that the Standard uses the term) is what the speaker
wants to express, and more often than not that assumption
is (I believe) not consistent with the actual circumstances.
Or perhaps, at least often not consistent.
I think it is.

Really? You think it's right in _all_ cases? Doesn't
that seem like an overly strong claim? Please note, when
I say "trying to make such a distinction", I don't mean
they are consciously intending to do so; only that they
want to convey _something_ and what it is they want to
convey is not the same as what the Standard labels as
"conversions" (presumably of the implicit variety).
I don't even remember who used the term "implicit cast" in this
thread (and I hope he or she isn't feeling picked on now). But I
don't believe that person was making the distinction you're trying
to make, either explicitly or implicitly.

Oh, there's a good chance he wasn't, and in fact there's a good
chance that people who use the phrase may not be consciously aware
of exactly what they do mean. They may not even know that there
is a term "conversion", or know what it means exactly. But none
of that matters. What does matter is, whether they know what is
or not, what do they really mean? If what they mean is not exactly
the same as "conversion", it's wrong to say that the term for what
they mean is "conversion" -- because it isn't.
x[y] is equivalent to *(x+y) (add extra parentheses to taste).
We might say that there's an implicit addition and dereference; we
don't talk about an implicit "+" sign and an implicit "*" operator.

Unfortunately cast operations don't have analogous terminology to
addition/+ and dereference/*. The word 'cast' refers to both the
abstract operation and to the construction that symbolizes the
operation.

No, it does not. The word "cast" refers to an expression consisting
of an expression preceded by a parenthesized type name. The Standard
uses the term "Cast operators" in a section title, but doesn't define
it as far as I can tell; it's reasonable to assume that it refers
to the parenthesized type name that forms part of a cast expression.
The abstract operation is not a "cast"; it's a "conversion".

It's true these two notions are similar, but they aren't exactly
the same. "Conversion" covers a wider set than is covered by "the
set of operations performed by a cast operator". Incidentally, the
Standard uses all of "cast", "cast operation", and "cast operator".
If you look in 6.5.4p4 I think you'll agree that the Standard
defines "cast" to mean both the parenthesized type name _and_ the
expression whose value is to be operated on. So I think the best
fit for the earlier example would equate "cast operator" with "+",
"cast operation" with "addition", and "cast" with, hmmm, not sure,
"sum", maybe?
It's the rules of the Standard that dictate the source and target types
in both cases. It's just different rules.

It's hard to take this as a serious comment. Obviously the rules
of the Standard determine the result type in both cases. However,
in one case the result type is determined by the type or types of
the operands, but in the other case it's determined solely by the
operator. It is only in the case of cast-expressions [1] that the
result type is a function solely of the operation and not the
type(s) of the operands. The word "conversion" covers both cases;
"cast" covers only one.

[1] that is, cast-expressions with a cast operator in them.
Close, but not close enough. I don't see why we *need* a term for
"conversion plus choice of target type".

I wasn't trying to argue that there should be such a term. I'm
just saying, it's because there is no such term that the word
'cast' is used in 'implicit cast', rather than some other more
appropriate word.
And I'm unwilling to
give up the extremely useful existing term "cast", with its utterly
unambiguous meaning, for this concept.

It's important to understand that I'm not asking anyone to do so.
Actually, we already have a term for "conversion plus choice of
target type". It's the phrase "conversion plus choice of target
type".

Three problems with this. One, this phrase is obviously just too
long to be useful. Two, the people who are likely to use the
phrase 'implicit cast' are likely also not to be familiar enough
with C jargon to latch on to this. Three, most important, what
we need is a term for a related but different notion, that one
kind of value is implicitly interoperable with another kind.
In fact, "implicitly interoperable" or "implicitly assignable"
might be worth considering as terms to describe the sort of
thing that is meant by people who use 'implicit cast' now.
 
T

Tim Rentsch

Richard Heathfield said:
Tim said:
Richard Heathfield said:
Tim Rentsch wrote:

[large snip]

I'm responding just briefly here; there are comments on
other points in several other recent followups.
This isn't to imply that anyone who uses the phrase "implicit
cast" is stupid or evil. It's a common mistake, and a perfectly
understandable one. But it is, in my opinion, a mistake, and one
worth correcting.
I wouldn't call using "implicit cast" as an English phrase a
mistake, because I don't think it's 'wrong'.
I would.

Of course it's
not technically accurate use of jargon.
And therefore it's wrong.

I think that's a foolish attitude.

Yes, that is eminently clear to me.

No doubt my thoughts about your attitude are equally clear to you.

My comment was not about your attitude, it was about the
attitude of the statement. If you have a reaction or
opinion regarding an attitude implicit in a statement
of mine (or anyone else for that matter), please do let
the group know which statement it is and share your
reaction to it. Or don't mention it at all, just as
you choose.

Why do you think that, in my original reply, I labelled my criticism
as a "nit"? Think think think...

I think you labelled your comments a nit because you consider any
use of the phrase 'implicit cast' a minor error. I don't agree
that any such use must be an error, even only a minor one, and I
think that insisting that it can only be an error leads to negative
results in the newsgroup. Terming the comments a nit implies that
what they are expressing are essentially facts, whereas in actuality
the most important point being expressed is not fact but opinion.
There is no doubt that the term 'implicit cast' is technically
incongruous. That fact does not mean that any use of the term
must be an error. It's important to differentiate the two
circumstances.
 
K

Keith Thompson

Tim Rentsch said:
I would say the two cases are different. The word 'irregardless'
is an invented word, apparently appearing for the first time in
the early 20th century. In the phrase 'implicit cast', both
'implicit' and 'cast' are used in their normal senses.

I had written a rather lengthy response to most of your points, but I've
decided to post just a summary.

There are several things that the phrase "implicit cast" might be
intended to mean. It doesn't actually mean any of them. It is
simply a misuse of the word "cast".

It's probably not necessary to make a point of correcting every
single usage of the phrase (though in this group that's probably
inevitable).

My point -- really, my *only* point -- is that "implicit cast" is not
the right (correct, precise, accurate, good, acceptable) phrase for
*anything*. Whatever it's supposed to mean, there's a better way
to say it.

If you have some other concept (say, some particular subset of
conversions) that you think is sufficiently useful to have its own
phrase, that's fine.
 
T

Tim Rentsch

Keith Thompson said:
I had written a rather lengthy response to most of your points, but I've
decided to post just a summary.

There are several things that the phrase "implicit cast" might be
intended to mean. It doesn't actually mean any of them. It is
simply a misuse of the word "cast".

It's probably not necessary to make a point of correcting every
single usage of the phrase (though in this group that's probably
inevitable).

My point -- really, my *only* point -- is that "implicit cast" is not
the right (correct, precise, accurate, good, acceptable) phrase for
*anything*. Whatever it's supposed to mean, there's a better way
to say it.

If you have some other concept (say, some particular subset of
conversions) that you think is sufficiently useful to have its own
phrase, that's fine.

You've written a short summary reply so I will do likewise.

I understand (at least I think I understand) where you're
coming from about "implicit cast".

However, I think focusing on the term is less important than
trying to understand what someone who uses the term is trying
to say. There's often a presumption about what the speaker
means by the term, based mostly on how an expert in the C
Standard thinks of it. I believe that's not a good fit in
many cases or perhaps even most cases. So rather than focusing
on the term and whether it's good or bad, I think it's more
important to allow that the speaker is trying to say /something/,
and to try to understand what that /something/ is, because
there's a very good chance that what is meant (which isn't
always the same from speaker to speaker) is not the same as
"conversion". Correcting use of the term is not helpful and
may even be negatively helpful if what the speaker is trying
to say is different from an automatic assumption about what
the term means. The goal should be to help the speaker find
appropriate language to describe what it is /he/ is trying to
describe, not to insist that he use a particular term that
may be quite different from what he's trying to describe.
 
R

Richard Bos

Keith Thompson said:
My point -- really, my *only* point -- is that "implicit cast" is not
the right (correct, precise, accurate, good, acceptable) phrase for
*anything*. Whatever it's supposed to mean, there's a better way
to say it.

I would say that it's even more important that the use of the phrase
"implicit cast" is a _very_ strong indicator that the writer does not
fully understand how conversions work in C.

Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,085
Messages
2,570,597
Members
47,220
Latest member
AugustinaJ

Latest Threads

Top