Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #12065 > unrolled thread
| Started by | Kaz Kylheku <kaz@kylheku.com> |
|---|---|
| First post | 2011-10-25 00:44 +0000 |
| Last post | 2011-11-04 14:51 -0700 |
| Articles | 20 on this page of 90 — 25 participants |
Back to article view | Back to comp.lang.c
John McCarthy died today. Kaz Kylheku <kaz@kylheku.com> - 2011-10-25 00:44 +0000
Re: John McCarthy died today. Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-10-25 01:27 -0700
Re: John McCarthy died today. Kleuskes & Moos <kleuske@somewhere.else.net> - 2011-10-25 09:27 +0000
Re: John McCarthy died today. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-10-25 11:27 +0100
Re: John McCarthy died today. Ark <akhasin@macroexpressions.com> - 2011-10-29 13:33 -0400
Re: John McCarthy died today. Willem <willem@toad.stack.nl> - 2011-10-29 17:51 +0000
Re: John McCarthy died today. Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-10-29 21:28 +0300
Re: John McCarthy died today. Keith Thompson <kst-u@mib.org> - 2011-10-29 11:57 -0700
Re: John McCarthy died today. Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-10-30 08:20 -0700
Re: John McCarthy died today. Ark <akhasin@macroexpressions.com> - 2011-11-04 05:20 -0400
Re: John McCarthy died today. Kaz Kylheku <kaz@kylheku.com> - 2011-11-04 15:53 +0000
Re: John McCarthy died today. James Kuyper <jameskuyper@verizon.net> - 2011-11-04 12:16 -0400
Re: John McCarthy died today. Kaz Kylheku <kaz@kylheku.com> - 2011-11-04 17:58 +0000
Re: John McCarthy died today. James Kuyper <jameskuyper@verizon.net> - 2011-11-04 20:49 -0400
Re: John McCarthy died today. Kaz Kylheku <kaz@kylheku.com> - 2011-11-05 01:55 +0000
Re: John McCarthy died today. "BartC" <bc@freeuk.com> - 2011-11-07 10:54 +0000
Re: John McCarthy died today. "Charles Richmond" <netnews@aquaporin4.com> - 2011-11-07 07:36 -0600
Re: John McCarthy died today. Kaz Kylheku <kaz@kylheku.com> - 2011-11-07 19:49 +0000
Re: John McCarthy died today. James Kuyper <jameskuyper@verizon.net> - 2011-11-07 15:49 -0500
Re: John McCarthy died today. Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-11-08 00:38 -0800
Re: John McCarthy died today. James Kuyper <jameskuyper@verizon.net> - 2011-11-08 07:05 -0500
Re: John McCarthy died today. lawrence.jones@siemens.com - 2011-11-08 09:12 -0500
Re: John McCarthy died today. Kaz Kylheku <kaz@kylheku.com> - 2011-11-08 16:48 +0000
Re: John McCarthy died today. James Kuyper <jameskuyper@verizon.net> - 2011-11-08 12:12 -0500
Re: John McCarthy died today. Kaz Kylheku <kaz@kylheku.com> - 2011-11-08 23:27 +0000
Re: John McCarthy died today. Keith Thompson <kst-u@mib.org> - 2011-11-08 14:10 -0800
Re: John McCarthy died today. James Kuyper <jameskuyper@verizon.net> - 2011-11-08 17:16 -0500
Re: John McCarthy died today. lawrence.jones@siemens.com - 2011-11-09 13:51 -0500
Re: Looping Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2011-11-09 19:21 -0700
Re: Looping Kaz Kylheku <kaz@kylheku.com> - 2011-11-10 02:34 +0000
Re: John McCarthy died today. Joe Wright <joewwright@comcast.net> - 2011-11-08 17:49 -0500
Re: John McCarthy died today. Keith Thompson <kst-u@mib.org> - 2011-11-08 16:35 -0800
Re: John McCarthy died today. Joe Wright <joewwright@comcast.net> - 2011-11-09 01:08 -0500
Re: John McCarthy died today. Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-11-09 01:26 -0800
Re: John McCarthy died today. Joe Wright <joewwright@comcast.net> - 2011-11-09 08:18 -0500
Re: John McCarthy died today. Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-11-09 05:32 -0800
Re: John McCarthy died today. Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-11-09 01:24 -0800
Re: John McCarthy died today. Quentin Carbonneaux <qcarbonn@invalid.com> - 2011-11-09 11:59 +0000
Re: John McCarthy died today. Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-11-09 05:34 -0800
Re: John McCarthy died today. Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-11-08 18:31 +0200
Re: John McCarthy died today. Keith Thompson <kst-u@mib.org> - 2011-11-07 14:06 -0800
Re: John McCarthy died today. "BartC" <bc@freeuk.com> - 2011-11-08 02:01 +0000
Re: John McCarthy died today. Keith Thompson <kst-u@mib.org> - 2011-11-07 23:16 -0800
Re: John McCarthy died today. Kaz Kylheku <kaz@kylheku.com> - 2011-11-08 05:18 +0000
Re: John McCarthy died today. Keith Thompson <kst-u@mib.org> - 2011-11-07 23:17 -0800
Re: John McCarthy died today. Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-11-08 01:46 -0800
Re: John McCarthy died today. "BartC" <bc@freeuk.com> - 2011-11-08 13:02 +0000
Re: John McCarthy died today. Keith Thompson <kst-u@mib.org> - 2011-11-08 14:19 -0800
Re: John McCarthy died today. Edward Rutherford <edward.p.rutherford79@REMOVETHIS.gmail.com> - 2011-11-08 22:23 +0000
Re: John McCarthy died today. James Kuyper <jameskuyper@verizon.net> - 2011-11-08 18:13 -0500
Re: John McCarthy died today. Kaz Kylheku <kaz@kylheku.com> - 2011-11-08 23:38 +0000
Re: John McCarthy died today. Kaz Kylheku <kaz@kylheku.com> - 2011-11-08 23:18 +0000
Re: John McCarthy died today. Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-11-10 12:40 +0200
Re: John McCarthy died today. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-11-10 11:39 +0000
Re: John McCarthy died today. "BartC" <bc@freeuk.com> - 2011-11-10 12:23 +0000
Re: John McCarthy died today. 88888 Dihedral <dihedral88888@googlemail.com> - 2011-11-10 05:38 -0800
Re: John McCarthy died today. Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-11-10 17:29 +0200
Re: John McCarthy died today. David Thompson <dave.thompson2@verizon.net> - 2011-11-21 02:39 -0500
Re: John McCarthy died today. Keith Thompson <kst-u@mib.org> - 2011-11-08 16:34 -0800
Re: John McCarthy died today. Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-11-09 01:37 -0800
Re: John McCarthy died today. Keith Thompson <kst-u@mib.org> - 2011-11-09 13:25 -0800
Re: John McCarthy died today. Ian Collins <ian-news@hotmail.com> - 2011-11-10 10:36 +1300
Re: John McCarthy died today. Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-11-09 23:47 -0800
Re: John McCarthy died today. Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-11-10 00:21 -0800
Re: John McCarthy died today. Keith Thompson <kst-u@mib.org> - 2011-11-10 03:04 -0800
Re: John McCarthy died today. gazelle@shell.xmission.com (Kenny McCormack) - 2011-11-10 15:20 +0000
Re: John McCarthy died today. Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-11-12 23:22 +0000
Re: John McCarthy died today. Kaz Kylheku <kaz@kylheku.com> - 2011-11-13 01:44 +0000
Re: John McCarthy died today. "Charles Richmond" <netnews@aquaporin4.com> - 2011-11-13 04:18 -0600
Re: John McCarthy died today. Kaz Kylheku <kaz@kylheku.com> - 2011-11-13 16:57 +0000
Re: John McCarthy died today. Robert Wessel <robertwessel2@yahoo.com> - 2011-11-13 11:59 -0600
Re: John McCarthy died today. gazelle@shell.xmission.com (Kenny McCormack) - 2011-11-13 18:54 +0000
Re: John McCarthy died today. Keith Thompson <kst-u@mib.org> - 2011-11-13 14:47 -0800
Re: John McCarthy died today. Kaz Kylheku <kaz@kylheku.com> - 2011-11-14 03:43 +0000
Re: John McCarthy died today. Ike Naar <ike@sverige.freeshell.org> - 2011-11-14 09:00 +0000
Re: John McCarthy died today. Kaz Kylheku <kaz@kylheku.com> - 2011-11-14 18:30 +0000
Re: John McCarthy died today. James Kuyper <jameskuyper@verizon.net> - 2011-11-14 14:44 -0500
Re: John McCarthy died today. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-11-14 20:13 +0000
Re: John McCarthy died today. Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-11-14 00:21 -0800
Re: John McCarthy died today. Lauri Alanko <la@iki.fi> - 2011-11-10 15:26 +0000
Re: John McCarthy died today. Kaz Kylheku <kaz@kylheku.com> - 2011-11-10 01:51 +0000
Re: John McCarthy died today. Edward Rutherford <edward.p.rutherford79@REMOVETHIS.gmail.com> - 2011-11-09 17:15 +0000
Re: John McCarthy died today. "BartC" <bc@freeuk.com> - 2011-11-09 18:04 +0000
Re: John McCarthy died today. Keith Thompson <kst-u@mib.org> - 2011-11-09 13:31 -0800
Re: John McCarthy died today. Robert Wessel <robertwessel2@yahoo.com> - 2011-11-09 15:53 -0600
Re: John McCarthy died today. "BartC" <bc@freeuk.com> - 2011-11-09 22:02 +0000
Re: John McCarthy died today. Keith Thompson <kst-u@mib.org> - 2011-11-09 14:14 -0800
Re: John McCarthy died today. Keith Thompson <kst-u@mib.org> - 2011-11-09 13:50 -0800
Re: John McCarthy died today. James Kuyper <jameskuyper@verizon.net> - 2011-11-08 07:10 -0500
Re: John McCarthy died today. Keith Thompson <kst-u@mib.org> - 2011-11-04 14:51 -0700
Page 1 of 5 [1] 2 3 4 5 Next page →
| From | Kaz Kylheku <kaz@kylheku.com> |
|---|---|
| Date | 2011-10-25 00:44 +0000 |
| Subject | John McCarthy died today. |
| Message-ID | <20111024204213.528@kylheku.com> |
He must have been waiting to outlive someone who perverted his inventions with dumb syntax: (if cond then else) -> cond ? then : else
[toc] | [next] | [standalone]
| From | Nick Keighley <nick_keighley_nospam@hotmail.com> |
|---|---|
| Date | 2011-10-25 01:27 -0700 |
| Message-ID | <a259f63d-f803-4693-80fe-bed89593fe9c@g20g2000yqh.googlegroups.com> |
| In reply to | #12065 |
On Oct 25, 1:44 am, Kaz Kylheku <k...@kylheku.com> wrote: > He must have been waiting to outlive someone who perverted his inventions > with dumb syntax: > > (if cond then else) -> cond ? then : else seems to be a bad month for progammers
[toc] | [prev] | [next] | [standalone]
| From | Kleuskes & Moos <kleuske@somewhere.else.net> |
|---|---|
| Date | 2011-10-25 09:27 +0000 |
| Message-ID | <j85vd8$qv3$1@dont-email.me> |
| In reply to | #12065 |
On Tue, 25 Oct 2011 00:44:13 +0000, Kaz Kylheku wrote:
> He must have been waiting to outlive someone who perverted his
> inventions with dumb syntax:
>
> (if cond then else) -> cond ? then : else
Requiescat in Pace.
-------------------------------------------------------------------------------
_____________________________
< I want a WESSON OIL lease!! >
-----------------------------
\
\
___
{~._.~}
( Y )
()~*~()
(_)-(_)
-------------------------------------------------------------------------------
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2011-10-25 11:27 +0100 |
| Message-ID | <0.60636b62d96022a4e2e9.20111025112714BST.87hb2x74e5.fsf@bsb.me.uk> |
| In reply to | #12065 |
Kaz Kylheku <kaz@kylheku.com> writes: > He must have been waiting to outlive someone who perverted his inventions > with dumb syntax: > > (if cond then else) -> cond ? then : else How quickly people forget! Originally (cond (c then) (t else)). John McCarthy might well have considered (if ...) to be a perversion of his invention! -- Ben.
[toc] | [prev] | [next] | [standalone]
| From | Ark <akhasin@macroexpressions.com> |
|---|---|
| Date | 2011-10-29 13:33 -0400 |
| Message-ID | <j8hdc9$tbd$1@news.albasani.net> |
| In reply to | #12065 |
On 10/24/2011 8:44 PM, Kaz Kylheku wrote: > He must have been waiting to outlive someone who perverted his inventions > with dumb syntax: > > (if cond then else) -> cond ? then : else Re dumb syntax - in the eye of the beholder. The ternary syntax is an /expression/ with type and value and, when used on (symbolic) constants is indispensable in static initialization, in particular, of const objects. -- Ark
[toc] | [prev] | [next] | [standalone]
| From | Willem <willem@toad.stack.nl> |
|---|---|
| Date | 2011-10-29 17:51 +0000 |
| Message-ID | <slrnjaof9n.1aaf.willem@toad.stack.nl> |
| In reply to | #12249 |
Ark wrote:
) On 10/24/2011 8:44 PM, Kaz Kylheku wrote:
)> He must have been waiting to outlive someone who perverted his inventions
)> with dumb syntax:
)>
)> (if cond then else) -> cond ? then : else
)
) Re dumb syntax - in the eye of the beholder.
) The ternary syntax is an /expression/ with type and value and, when used
) on (symbolic) constants is indispensable in static initialization, in
) particular, of const objects.
(if cond then else) is *also* an expression with type and value, stupid.
SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
[toc] | [prev] | [next] | [standalone]
| From | Phil Carmody <thefatphil_demunged@yahoo.co.uk> |
|---|---|
| Date | 2011-10-29 21:28 +0300 |
| Message-ID | <87zkgjk5y0.fsf@bazspaz.fatphil.org> |
| In reply to | #12250 |
Willem <willem@toad.stack.nl> writes: > Ark wrote: > ) On 10/24/2011 8:44 PM, Kaz Kylheku wrote: > )> He must have been waiting to outlive someone who perverted his inventions > )> with dumb syntax: > )> > )> (if cond then else) -> cond ? then : else > ) > ) Re dumb syntax - in the eye of the beholder. > ) The ternary syntax is an /expression/ with type and value and, when used > ) on (symbolic) constants is indispensable in static initialization, in > ) particular, of const objects. > > (if cond then else) is *also* an expression with type and value, stupid. I'm not sure I see anything by Ark that contradicts that, in particular as he says precisely nothing about the lisp form. Phil -- Unix is simple. It just takes a genius to understand its simplicity -- Dennis Ritchie (1941-2011), Unix Co-Creator
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2011-10-29 11:57 -0700 |
| Message-ID | <lnipn7k4m0.fsf@nuthaus.mib.org> |
| In reply to | #12250 |
Willem <willem@toad.stack.nl> writes:
> Ark wrote:
> ) On 10/24/2011 8:44 PM, Kaz Kylheku wrote:
> )> He must have been waiting to outlive someone who perverted his inventions
> )> with dumb syntax:
> )>
> )> (if cond then else) -> cond ? then : else
> )
> ) Re dumb syntax - in the eye of the beholder.
> ) The ternary syntax is an /expression/ with type and value and, when used
> ) on (symbolic) constants is indispensable in static initialization, in
> ) particular, of const objects.
>
> (if cond then else) is *also* an expression with type and value, stupid.
Perhaps you could express technical disagreements without calling
people stupid -- especially in a thread about the death of a
programming language pioneer.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
[toc] | [prev] | [next] | [standalone]
| From | Nick Keighley <nick_keighley_nospam@hotmail.com> |
|---|---|
| Date | 2011-10-30 08:20 -0700 |
| Message-ID | <882b4907-2bf2-47f5-a30b-21f58efa441f@a7g2000yqd.googlegroups.com> |
| In reply to | #12258 |
On Oct 29, 6:57 pm, Keith Thompson <ks...@mib.org> wrote: > Willem <wil...@toad.stack.nl> writes: > > Ark wrote: > > ) On 10/24/2011 8:44 PM, Kaz Kylheku wrote: > > )> He must have been waiting to outlive someone who perverted his inventions > > )> with dumb syntax: > > )> > > )> (if cond then else) -> cond ? then : else > > ) > > ) Re dumb syntax - in the eye of the beholder. > > ) The ternary syntax is an /expression/ with type and value and, when used > > ) on (symbolic) constants is indispensable in static initialization, in > > ) particular, of const objects. > > > (if cond then else) is *also* an expression with type and value, stupid. > > Perhaps you could express technical disagreements without calling > people stupid -- especially in a thread about the death of a > programming language pioneer. "dumb syntax" wasn'texactly a good start
[toc] | [prev] | [next] | [standalone]
| From | Ark <akhasin@macroexpressions.com> |
|---|---|
| Date | 2011-11-04 05:20 -0400 |
| Message-ID | <j90aoo$jom$1@news.albasani.net> |
| In reply to | #12250 |
On 10/29/2011 1:51 PM, Willem wrote: > Ark wrote: > ) On 10/24/2011 8:44 PM, Kaz Kylheku wrote: > )> He must have been waiting to outlive someone who perverted his inventions > )> with dumb syntax: > )> > )> (if cond then else) -> cond ? then : else > ) > ) Re dumb syntax - in the eye of the beholder. > ) The ternary syntax is an /expression/ with type and value and, when used > ) on (symbolic) constants is indispensable in static initialization, in > ) particular, of const objects. > > (if cond then else) is *also* an expression with type and value, stupid. > > > SaSW, Willem A distinction between expression and type-and-value-less statement is a Good Thing, perhaps contrary to what purists might say. The fact that in C (and descendants) the assignment operator is an expression is indeed unfortunate and has lead to innumerable bugs stemming from clever coding. So there, smart Willem.
[toc] | [prev] | [next] | [standalone]
| From | Kaz Kylheku <kaz@kylheku.com> |
|---|---|
| Date | 2011-11-04 15:53 +0000 |
| Message-ID | <20111104115106.357@kylheku.com> |
| In reply to | #12667 |
On 2011-11-04, Ark <akhasin@macroexpressions.com> wrote: > The fact that in > C (and descendants) the assignment operator is an expression is indeed > unfortunate and has lead to innumerable bugs stemming from clever > coding. This is the consequence of how the operator is spelled, not what kind of expression it is. Doh!
[toc] | [prev] | [next] | [standalone]
| From | James Kuyper <jameskuyper@verizon.net> |
|---|---|
| Date | 2011-11-04 12:16 -0400 |
| Message-ID | <4EB40FC0.8090206@verizon.net> |
| In reply to | #12687 |
On 11/04/2011 11:53 AM, Kaz Kylheku wrote: > On 2011-11-04, Ark <akhasin@macroexpressions.com> wrote: >> The fact that in >> C (and descendants) the assignment operator is an expression is indeed >> unfortunate and has lead to innumerable bugs stemming from clever >> coding. > > This is the consequence of how the operator is spelled, not what kind > of expression it is. Doh! I thought it was a consequence of the grammar, not the spelling of the operator. The problem is due entirely to the fact that there is such a thing in C as an expression that performs assignment, while C has no such thing as an assignment statement - the closest it comes is an expression-statement where the relevant expression is an assignment expression. Those facts are completely independent of the spelling of the assignment operator. What alternative spelling for the assignment operator are you suggesting, that could, without a change to any of the features of the grammar that I described above, avoid this problem?
[toc] | [prev] | [next] | [standalone]
| From | Kaz Kylheku <kaz@kylheku.com> |
|---|---|
| Date | 2011-11-04 17:58 +0000 |
| Message-ID | <20111104135545.861@kylheku.com> |
| In reply to | #12692 |
On 2011-11-04, James Kuyper <jameskuyper@verizon.net> wrote:
> On 11/04/2011 11:53 AM, Kaz Kylheku wrote:
>> On 2011-11-04, Ark <akhasin@macroexpressions.com> wrote:
>>> The fact that in
>>> C (and descendants) the assignment operator is an expression is indeed
>>> unfortunate and has lead to innumerable bugs stemming from clever
>>> coding.
>>
>> This is the consequence of how the operator is spelled, not what kind
>> of expression it is. Doh!
>
> I thought it was a consequence of the grammar, not the spelling of the
> operator. The problem is due entirely to the fact that there is such a
> thing in C as an expression that performs assignment, while C has no
> such thing as an assignment statement - the closest it comes is an
> expression-statement where the relevant expression is an assignment
> expression. Those facts are completely independent of the spelling of
> the assignment operator.
Which problem?
I'm thinking of accidental assignments:
if (defence_condition = UNDER_NUCLEAR_ATTACK)
launch_full_counterstrike();
This problem is caused by the similarity of == and =, but, sure, it would also
go away if you couldn't have an assignment in that context.
Other languages have assignment expressions, but programmers don't make these
mistakes.
;; Lisp
;; actually wanted EQ, but wrote SETF? Vanishingly unlikely.
(when (setf defence-condition :under-nuclear-attack) ...)
[toc] | [prev] | [next] | [standalone]
| From | James Kuyper <jameskuyper@verizon.net> |
|---|---|
| Date | 2011-11-04 20:49 -0400 |
| Message-ID | <j9216t$ss2$1@dont-email.me> |
| In reply to | #12705 |
On 11/04/2011 01:58 PM, Kaz Kylheku wrote: ... > Which problem? > > I'm thinking of accidental assignments: > > if (defence_condition = UNDER_NUCLEAR_ATTACK) > launch_full_counterstrike(); > > This problem is caused by the similarity of == and =, but, sure, it would also > go away if you couldn't have an assignment in that context. And my point is that's the superior solution. Making an assignment an expression that has a value which can be used in other expressions is a feature that's seldom taken advantage of, has little to recommend it, and is frequently misused. The language would be cleaner without it. I don't feel strongly enough about this point to recommend removing this feature from any of the several well-established languages that already has it, but I would recommend not copying that feature in any new languages. -- James Kuyper
[toc] | [prev] | [next] | [standalone]
| From | Kaz Kylheku <kaz@kylheku.com> |
|---|---|
| Date | 2011-11-05 01:55 +0000 |
| Message-ID | <20111104214808.434@kylheku.com> |
| In reply to | #12746 |
On 2011-11-05, James Kuyper <jameskuyper@verizon.net> wrote: > On 11/04/2011 01:58 PM, Kaz Kylheku wrote: > ... >> Which problem? >> >> I'm thinking of accidental assignments: >> >> if (defence_condition = UNDER_NUCLEAR_ATTACK) >> launch_full_counterstrike(); >> >> This problem is caused by the similarity of == and =, but, sure, it would also >> go away if you couldn't have an assignment in that context. > > And my point is that's the superior solution. You have to make up your mind what the root cause is of the =/== mixup bugs. Is it: a) similarity between = and == b) expressions that can contain side effects? If you say b, but then you redesign the language by only eliminating the plain assignment operator from expressions, while continuing to allow expressions to use operators like &= and ++, and to call functions that have side effects, that is inconsistent with your point! You're then admitting that the side effects are not really the root cause, just the assignment operator specifically. If you believe b) you can make an imperative language in which expressions are purely functional: no side effects, and calls to pure functions only, not to procedures. But it remains that it's the similarity between = and == that leads to the programming mistake. The programmer did not make some mistake in the destructive manipulation of data; he didn't even want the expression to be destructive, but only misspelled the darn operator! How will you protect the programmer from misspelling one non-destructive operator for another in a pure expression? What programming language butchery do you recommend for the situation when - is written instead of +?
[toc] | [prev] | [next] | [standalone]
| From | "BartC" <bc@freeuk.com> |
|---|---|
| Date | 2011-11-07 10:54 +0000 |
| Message-ID | <j98dee$fmo$1@dont-email.me> |
| In reply to | #12750 |
"Kaz Kylheku" <kaz@kylheku.com> wrote in message news:20111104214808.434@kylheku.com... > But it remains that it's the similarity between = and == that leads to > the programming mistake. The programmer did not make some mistake in > the destructive manipulation of data; he didn't even want the expression > to be destructive, but only misspelled the darn operator! > > How will you protect the programmer from misspelling one non-destructive > operator for another in a pure expression? > > What programming language butchery do you recommend for the situation > when - is written instead of +? "-" isn't generally used, in a million other contexts outside of the language, to mean "+". In everyday life, "=" *does* usually mean "equals". So the mistake is simply more likely. So things can be done about it, such as only allowing (a=b) to return a value when used on the rhs of another assignment. Or requiring an explicit operator to extract the value of (a=b). It would be a dramatic change to the language, but it will never be done because opponents will insist that anyone who gets = and == mixed up is just a lousy programmer and should be looking for a simpler occupation. -- bartc
[toc] | [prev] | [next] | [standalone]
| From | "Charles Richmond" <netnews@aquaporin4.com> |
|---|---|
| Date | 2011-11-07 07:36 -0600 |
| Message-ID | <j98mtg$9t1$1@dont-email.me> |
| In reply to | #12839 |
"BartC" <bc@freeuk.com> wrote in message news:j98dee$fmo$1@dont-email.me...
> "Kaz Kylheku" <kaz@kylheku.com> wrote in message
> news:20111104214808.434@kylheku.com...
>
>> But it remains that it's the similarity between = and == that leads to
>> the programming mistake. The programmer did not make some mistake in
>> the destructive manipulation of data; he didn't even want the expression
>> to be destructive, but only misspelled the darn operator!
>>
>> How will you protect the programmer from misspelling one non-destructive
>> operator for another in a pure expression?
>>
>> What programming language butchery do you recommend for the situation
>> when - is written instead of +?
>
> "-" isn't generally used, in a million other contexts outside of the
> language, to mean "+".
>
> In everyday life, "=" *does* usually mean "equals".
>
> So the mistake is simply more likely.
>
> So things can be done about it, such as only allowing (a=b) to return a
> value when used on the rhs of another assignment. Or requiring an
> explicit operator to extract the value of (a=b). It would be a dramatic
> change to the language, but it will never be done because opponents will
> insist that anyone who gets = and == mixed up is just a lousy programmer
> and should be looking for a simpler occupation.
>
But assignment *can* be used on the lhs of the statement. See the following
code:
int *a, *b;
a = malloc(sizeof(int));
*(b=a) = 47;
--
+<><><><><><><><><><><><><><><><><><><>+
| Charles Richmond numerist@aquaporin4.com |
+<><><><><><><><><><><><><><><><><><><>+
[toc] | [prev] | [next] | [standalone]
| From | Kaz Kylheku <kaz@kylheku.com> |
|---|---|
| Date | 2011-11-07 19:49 +0000 |
| Message-ID | <20111107114608.386@kylheku.com> |
| In reply to | #12839 |
On 2011-11-07, BartC <bc@freeuk.com> wrote: > "Kaz Kylheku" <kaz@kylheku.com> wrote in message > news:20111104214808.434@kylheku.com... > >> But it remains that it's the similarity between = and == that leads to >> the programming mistake. The programmer did not make some mistake in >> the destructive manipulation of data; he didn't even want the expression >> to be destructive, but only misspelled the darn operator! >> >> How will you protect the programmer from misspelling one non-destructive >> operator for another in a pure expression? >> >> What programming language butchery do you recommend for the situation >> when - is written instead of +? > > "-" isn't generally used, in a million other contexts outside of the > language, to mean "+". What if in some insane language, subtraction were written "++" and addition "+"? Would you fix the language with some insane restructuring of its fundamental rules, or would you fix the damn spelling of "++" to "-"? Being able to identify the true root cause of a problem is indispensable in the computing business. > In everyday life, "=" *does* usually mean "equals". > > So the mistake is simply more likely. Here you seem agree with the spelling hypothesis. Since = means equals, programmers sometimes mistakenly use the wrong operator. If = actually meant "equals", and assignment was spelled <= or :=, this mistake would approximately vanish. > So things can be done about it, such as only allowing (a=b) to return a > value when used on the rhs of another assignment. Here, you seem disagree with the spelling hypothesis; it's a deeper problem related to the context in which = is or is not allowed. We ought to keep the = operator's spelling as it is, but compensate for it with additional complications. > Or requiring an explicit > operator to extract the value of (a=b). It would be a dramatic change to the > language, but it will never be done because opponents will insist that All of those are dramatic changes: changing the spelling of an operator, or fiddling with various semantic rules.
[toc] | [prev] | [next] | [standalone]
| From | James Kuyper <jameskuyper@verizon.net> |
|---|---|
| Date | 2011-11-07 15:49 -0500 |
| Message-ID | <4EB84456.7030800@verizon.net> |
| In reply to | #12854 |
On 11/07/2011 02:49 PM, Kaz Kylheku wrote: ... > What if in some insane language, subtraction were written "++" and addition > "+"? > > Would you fix the language with some insane restructuring of its fundamental > rules, or would you fix the damn spelling of "++" to "-"? I would not recommend any change to C itself, because the need for backwards compatibility prevents any meaningful fix to this problem. Either change would be "insane" because of the huge amount of existing code that would be broken. As a feature of a brand new language, I wouldn't characterize the idea that assignment should be a statement type and not an expression type insane. It's a normal feature of many existing languages. I would recommend making BOTH fixes for a new language: the grammatical one and the spelling one.
[toc] | [prev] | [next] | [standalone]
| From | Nick Keighley <nick_keighley_nospam@hotmail.com> |
|---|---|
| Date | 2011-11-08 00:38 -0800 |
| Message-ID | <ad819d7c-54f6-4e23-8aad-1fbe29d16ff3@o13g2000vbo.googlegroups.com> |
| In reply to | #12856 |
On Nov 7, 8:49 pm, James Kuyper <jameskuy...@verizon.net> wrote:
> On 11/07/2011 02:49 PM, Kaz Kylheku wrote:
> ...
>
> > What if in some insane language, subtraction were written "++" and addition
> > "+"?
>
> > Would you fix the language with some insane restructuring of its fundamental
> > rules, or would you fix the damn spelling of "++" to "-"?
>
> I would not recommend any change to C itself, because the need for
> backwards compatibility prevents any meaningful fix to this problem.
> Either change would be "insane" because of the huge amount of existing
> code that would be broken.
>
> As a feature of a brand new language, I wouldn't characterize the idea
> that assignment should be a statement type and not an expression type
> insane. It's a normal feature of many existing languages.
so are assignment expressions
I've always quite liked the idiom
int c;
while ((c = getchar ()) != EOF)
process_char (c);
it often saves clumsy code
int c = getchar ();
while (c != EOF)
{
process_char (c);
c = getchar ();
}
> I would recommend making BOTH fixes for a new language: the grammatical
> one and the spelling one.
[toc] | [prev] | [next] | [standalone]
Page 1 of 5 [1] 2 3 4 5 Next page →
Back to top | Article view | comp.lang.c
csiph-web