Another spinoza challenge

F

Flash Gordon

Dennis said:
Flash Gordon said:

How can something that causes compilation compilation to abort be
considered valid on that implementation?
Didn't say it was a #define.

No, but *I* said it was on a specific implementation, and one provided
by the implementation for its own use.
Only if there is a conflict. That could hapen if the symbol is defined
twice or in conflicting ways, which is true of...well..any identifier.
Whether beginning with an underscore or not.

You raised this before, and as I tried to point out that is not a
reasonable objection.

I'm talking about the IMPLEMENTATION making the code invalid, not some
other error on the code. I'm talking about the IMPLEMENTATION making the
following translation unit invalid
int _MAX_POWER;

I think it perfectly reasonable to tell a beginner (and have the answer
to a beginner test) that it they are not allowed to use names which
cannot on all implementations be used in a one line C file containing
the single definition
int nameinquestion;
By failing "yes", you're saying no one can use it for
defnition/declaration, lhs, rhs- that there is no validity for such an
identifier AT ALL.

No, by failing it I'm saying that the person being tested thinks they
are free to use the identifier which is WRONG.
And that is wrong. If you want to restrict validity
to be what should be defined by an application (keying off the
identifies beginning with _ belonging to implementation or all caps
typically referring to macros) then that should be part of the question.
Otherwise, you're just asking what's a valid identifer - regardless of
context.

Ah, but in SOME contexts it is NOT a valid identifier (i.e. where an
implementation has done something making it invalid as an identifier),
so if you ignore context the only safe assumption is that it is NOT valid.
Never said it wasn't.

If you don't think it is reasonable, why argue against it without at
least acknowledging that it is reasonable?
But it does read more into the question that what
was asked.

I disagree, and I've explained why in the context of the question it is
a reasonable interpretation. I've also explained why a beginner should
start off by being told they should not use any identifier starting with
an underscore (which would lead the student to give the answer that it
is invalid).
 
P

Phil Carmody

James Kuyper said:
To you, it is "of course". We have no basis for judging your
competence at that time relative to that of the tutor, so it's not
obviously true to the rest of us. That is not meant to disparage your
competence, merely to ask for more details; could you given an example
of the kind of statements that you were making using the word "weight"
that he was objecting to? I'm not asking you to remember a specific
usage, just an example of the kind of thing he was objecting to.

"It weighs 10 kilograms."

Phil
 
P

Phil Carmody

Dik T. Winter said:
Hm. So in the Fortran code:
SUBROUTINE SUB(A)
A = 1.0
RETURN
END
SUBROUTINE SUB1(C)
REAL A
CALL SUB(A)
C = A
RETURN
END
there is no pass by reference?


Personally my response would have been "what you've said is somewhere
between illucid and wrong". E.g. the "calling procedure's copy of the
parameter" bit. Yikes.

Phil
 
P

Phil Carmody

Were you applying for a science, a literature, or a sociology degree? If
the first, he was both correct and justified. If the second, he was
wrong. If the last, neither of you could possibly have been wrong,
because in that subject, anything goes.

None of the three. Mathematics. The interview took place using spoken
English rather than equations. Therefore I used words with unambiguous
meanings in English. If I was refering to force, I'd use the word
force, and if I was refering to heft, I'd use the word weight.

Phil
 
N

Nick Keighley

Now try defining a variable named __LINE__...

that wasn't what was being discussed. Re-read the above particularly
the bit:-

"Why on earth does the implementation *define* them if you're not
supposed to *use* them?"

<snip>
 
N

Nick Keighley

"It weighs 10 kilograms."

good grief. In what conext does it weigh 10kgs?

"The spare battery on the lunar rover weighs 10kgs"

It kind of matters where you do the weighing as to what that means.

Even on the earth's surface weight varies if you do the measurement
carefully enough. So we *still* don't know if the interviewer was a
mindless pedant or you didn't know some basic physics.

In an interview I had I had to point out to professor of physics
that the laser beam worked much better if you Plugged It In.
I always wondered if that was part of the test...
 
N

Nick Keighley

Were you applying for a science, a literature, or a sociology degree? If
the first, he was both correct and justified. If the second, he was
wrong. If the last, neither of you could possibly have been wrong,
because in that subject, anything goes.

It's simply a matter of determining if the questioner is a Marxist,
Neo-marxist
or the-third-option-whos-name-I-don't-recall I give the approved
answer. If in
doubt quote Dirkheim. I'm sure spinoza would be happy to explain it to
you.
 
N

Nick Keighley

None of the three. Mathematics. The interview took place using spoken
English rather than equations. Therefore I used words with unambiguous
meanings in English. If I was refering to force, I'd use the word
force, and if I was refering to heft, I'd use the word weight.

applied mathematics you said. What's the "heft" of a 10kg mass in
free fall?
 
I

Ike Naar

"It weighs 10 kilograms."

<off topic:>

Actually, the kilogram is an SI unit of mass.

"Weight" is the force on an object due to the gravitational attraction
between it and the Earth (or another nearby heav(enl)y body).
The SI unit of weight is the Newton (N), 1 N = 1 kg*m/s/s .
The weight of an object equals its mass times the local gravitational
acceleration constant, g (approximately 9.8 m/s/s on the surface of the Earth).

So, instead of saying "it weighs 10 kilograms" it would be more accurate
to say "its mass is 10 kilograms" or "it weighs 98 Newton" (on Earth).
 
N

Nick Keighley

This is one of the those odd c.l.c debates where I don't think anyone
is disputing facts but simply disputing if the facts support a
particular turn of phrase.

"A lot of the c.l.c. verbiage seems to be devoted to the numerical
density of cavorting nubile seraphim upon pinheads."
CBFalconer
 
B

bartc

Ike Naar said:
<off topic:>

Actually, the kilogram is an SI unit of mass.

"Weight" is the force on an object due to the gravitational attraction
between it and the Earth (or another nearby heav(enl)y body).
The SI unit of weight is the Newton (N), 1 N = 1 kg*m/s/s .
The weight of an object equals its mass times the local gravitational
acceleration constant, g (approximately 9.8 m/s/s on the surface of the
Earth).

So, instead of saying "it weighs 10 kilograms" it would be more accurate
to say "its mass is 10 kilograms" or "it weighs 98 Newton" (on Earth).

Both my kitchen and bathroom scales have readouts in Kg and g. What are they
measuring, weight, mass or both?
 
T

Tim Streater

Richard Heathfield said:
bartc said:



Assuming ordinary spring-type scales, they are measuring weight, and
they are therefore mislabelled.

You are only measuring mass if you have a *balance* (i.e. one of the
"old-fashioned" type with two pans where you put the object in one pan
and labelled "weights" in the other).

Such a balance will give the same results (e.g. measure your 1lb of
steak as 1lb) whether used on earth or moon. Your spring scales will
measure your 1lb of steak on earth as 1lb, but only as 2.3oz or so on
the moon.
 
B

bartc

Richard Heathfield said:
bartc said:



Assuming ordinary spring-type scales, they are measuring weight, and
they are therefore mislabelled.

They're electronic, so piezo-electric or whatever, but they aren't balances
anyway. So yes they're measuring downward force.

The point is it makes perfect sense to at least 90% of the population
(probably nearer 100%) to have weight measured in Kg and lbs, rather than
newtons or whatever. So why not use terms that everyone understands?
 
J

James Kuyper

Phil said:
"It weighs 10 kilograms."

I'm sure that this will make you label me as a pedant, but if this was
in the context of applying to study math, science, or engineering, the
tutor had every just cause for correcting you. If you want to
deliberately confuse mass and weight, use "pounds", where that confusion
has some official endorsement. One of the key purposes of defining
separately named units for mass (grams) and force (Newtons) is to keep
the concepts clearly distinct from each other.
 
R

Richard Tobin

Both my kitchen and bathroom scales have readouts in Kg and g. What
are they measuring, weight, mass or both?
[/QUOTE]
Assuming ordinary spring-type scales, they are measuring weight, and
they are therefore mislabelled.

The display is determined by the extension of the spring. Should they
be labelled in metres?

My voltmeter's needle moves because of the magnetic field generated
by a current. Are you suggesting that it too is mislabelled?

Spring scales measure mass by determining the extension of a known
spring in a known gravitational field. Very few instruments directly
sense what they display.

-- Richard
 
D

Dennis \(Icarus\)

Flash Gordon said:
How can something that causes compilation compilation to abort be
considered valid on that implementation?

Ok, I kept talking about the immplementation providing _MAX_POWER as a
variable.
No, but *I* said it was on a specific implementation, and one provided by
the implementation for its own use.

If it's only for its own use, then would it be in a public header?
You raised this before, and as I tried to point out that is not a
reasonable objection.

Sure it is. The question just asked what was a valid idetifier.
Said nothing about context, so all should be considered.
I'm talking about the IMPLEMENTATION making the code invalid, not some
other error on the code. I'm talking about the IMPLEMENTATION making the
following translation unit invalid
int _MAX_POWER;

I think it perfectly reasonable to tell a beginner (and have the answer to
a beginner test) that it they are not allowed to use names which cannot on
all implementations be used in a one line C file containing the single
definition
int nameinquestion;

That wasn't the question though.
No, by failing it I'm saying that the person being tested thinks they are
free to use the identifier which is WRONG.

That's not what the question was though.
Ah, but in SOME contexts it is NOT a valid identifier (i.e. where an
implementation has done something making it invalid as an identifier), so
if you ignore context the only safe assumption is that it is NOT valid.

By "doing something" means "defining a symbol with that name", means that
the identifier is valid, else the implementation could not use it either.
If you don't think it is reasonable, why argue against it without at least
acknowledging that it is reasonable?

I answered that below. It reads more into the question than was asked.
I disagree, and I've explained why in the context of the question it is a
reasonable interpretation. I've also explained why a beginner should start
off by being told they should not use any identifier starting with an
underscore (which would lead the student to give the answer that it is
invalid).

be sure that's what you're asking though.
If you simply ask what is a valid identifier, then you leave it open for
identifiers in all contexts - user-defined or implementation defined.

Dennis
 
N

Nick Keighley

They're electronic, so piezo-electric or whatever, but they aren't balances
anyway. So yes they're measuring downward force.

The point is it makes perfect sense to at least 90% of the population
(probably nearer 100%) to have weight measured in Kg and lbs, rather than
newtons or whatever. So why not use terms that everyone understands?

you could talk about Kg-force (Kgf) or lbf if you want to be careful.
Personally I have no objection to someone saying something weighs
10kgs.
In normal conversation. I'm not sure an applied maths interview is
normal.
 
D

Dik T. Winter

>
> That's not pass by reference, that's pass by name. Some languages
> implement both, and call them both pass by reference, but they are
> clearly different mechanisms with clearly different syntax both at
> the caller and the callee.

No, the syntax for call by reference and call by name is identical. There
is a difference at the callers side, if there is an expression involved. In
the case of call by reference, the caller evaluates the expression it has
to pass and passes the address of that expression, in the case of call by
name the caller does *not* evaluate the expression but passes the address of
a routine that calculates the expression (and for simple variables as
expression also the address of a routine that assigns a value to the
variable). E.g. in Algol 60:
"integer" "procedure" sum(ai, i, low, upp); "value" low, upp;
"integer" ai, i, low, upp;
"begin" "integer" s;
s:= 0;
"for" i:= low "step" 1 "until" upp "do" s:= s + ai;
sum:= s
"end";
"integer" i;
"integer" total;
i:= 0;
total:= sum(i + 1, i, 1, 10);
will yield the value 65 in total. If it were call by reference the result
would be 10, without change of syntax. This would also be the result if it
has been stated that ai and i were call-by-value (again without further
change of syntax).
 
S

spinoza1111

Julienne Walker said:



That's certainly a defensible view, but it is precisely because very
often not all parties /do/ understand this that I prefer to maintain
the distinction.

This is because your goal is to "prove" that people don't know things
that they actually do know, but fail to express your way. This, in
turn, is because you're here to destroy people, not to make a
contribution.
 
S

spinoza1111

spinoza1111said:



It is not my place to allow or disallow your incorrect usage of
terminology.




There is no better test than comp.lang.c.

Don't make me laugh. A bunch of fat assed misfits with time on their
hands owing to long-term unemployment is not exactly a tribunal.
 

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

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top