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 | 10 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 5 of 5 — ← Prev page 1 2 3 4 [5]
| From | Kaz Kylheku <kaz@kylheku.com> |
|---|---|
| Date | 2011-11-10 01:51 +0000 |
| Message-ID | <20111109174705.87@kylheku.com> |
| In reply to | #12946 |
On 2011-11-09, Malcolm McLean <malcolm.mclean5@btinternet.com> wrote: > On Nov 9, 2:34 am, Keith Thompson <ks...@mib.org> wrote: >> >> So tell us, how would you address the problem of existing code that >> uses "=" for assignment, and of new code using ":=" for assignment >> that would no longer compile with older compilers? Similarly, >> how would you address the legions of C programmers who believe >> (rightly or wrongly) that using "=" for assignment and "==" for >> equality is ok, and doesn't need to be fixed? >> > You need to make the change compulsory, so the Luddites will have to If I could make such things compulsory, I wouldn't bother with compilers. I would make it compulsory for, say, everyone in North America to give me a dollar. To hell with making some programmers use a different compiler.
[toc] | [prev] | [next] | [standalone]
| From | Edward Rutherford <edward.p.rutherford79@REMOVETHIS.gmail.com> |
|---|---|
| Date | 2011-11-09 17:15 +0000 |
| Message-ID | <j9eceq$jb3$1@speranza.aioe.org> |
| In reply to | #12935 |
Keith Thompson wrote: > Edward Rutherford <edward.p.rutherford79@REMOVETHIS.gmail.com> writes: >> Keith Thompson wrote: > [...] >>> Using "=" for assignment was not, in my opinion, a good idea. Any >>> attempt to change it now would be far worse. >> >> With this attitude, the language will never improve! > > With any other attitude, the language will die. > > If you think that changing the C language to use ":=" rather than for > assignment is a good idea, that's not an unreasonable opinion, at least > at first glance. Frankly, I *wish* I could agree. But if you want to > propose such a change and have it taken seriously, you need to address > the problems it could cause (as I did in my previous message). > > So tell us, how would you address the problem of existing code that uses > "=" for assignment, and of new code using ":=" for assignment that would > no longer compile with older compilers? Similarly, how would you > address the legions of C programmers who believe (rightly or wrongly) > that using "=" for assignment and "==" for equality is ok, and doesn't > need to be fixed? > > Please be specific. Python has dealt with this problem very successfully, Kieth: see http:// www.python.org/dev/peps/pep-0005/ for some general approaches, but also http://docs.python.org/release/3.0/whatsnew/3.0.html for details about transitioning to "the first ever intentionally backwards incompatible Python release". One of the key planks supporting upgrades to Python 3.0 is an automated conversion tool, 2to3 (http://docs.python.org/release/3.0/ library/2to3.html#to3-reference), which automatically upgrades 2.x source code to valid 3.0 Python syntax. It would be a simple matter to write a converter that read a C source file and replaced all = assignment operators with := Incidentally, Python has many convenient features that could easily be added to C, e.g. multiple comparisons behave correctly (a < b > c etc); array and string slicing e.g. s[4:7] as a shortcut for strndup(s+4,3); else clauses on loops; and many more. Unfortunately the current fashion seems to be to try to preserve C in aspic.
[toc] | [prev] | [next] | [standalone]
| From | "BartC" <bc@freeuk.com> |
|---|---|
| Date | 2011-11-09 18:04 +0000 |
| Message-ID | <j9efd6$lej$1@dont-email.me> |
| In reply to | #12975 |
"Edward Rutherford" <edward.p.rutherford79@REMOVETHIS.gmail.com> wrote in message news:j9eceq$jb3$1@speranza.aioe.org... > Keith Thompson wrote: >> So tell us, how would you address the problem of existing code that uses >> "=" for assignment, and of new code using ":=" for assignment that would >> no longer compile with older compilers? Similarly, how would you >> address the legions of C programmers who believe (rightly or wrongly) >> that using "=" for assignment and "==" for equality is ok, and doesn't >> need to be fixed? >> >> Please be specific. > > Python has dealt with this problem very successfully, Kieth: see http:// > www.python.org/dev/peps/pep-0005/ for some general approaches, but also > http://docs.python.org/release/3.0/whatsnew/3.0.html for details about > transitioning to "the first ever intentionally backwards incompatible > Python release". > > One of the key planks supporting upgrades to Python 3.0 is an automated > conversion tool, 2to3 (http://docs.python.org/release/3.0/ > library/2to3.html#to3-reference), which automatically upgrades 2.x source > code to valid 3.0 Python syntax. Python is a more superficial language. Upgrading Python sources is bit like replacing the old window frames in a house; upgrading C is more like replacing the mortar between the bricks. Also it would be necessary to partition C between old C, and new C (equivalent of versions 2.x and 3.x), and to maintain that strict delineation. With C sources appearing everywhere on the internet, it would be a nightmare. Effectively you would be creating a new language. It wouldn't be worth the trouble unless you tidied up a few other things too, and then you really would have a new language. > It would be a simple matter to write a converter that read a C source > file and replaced all = assignment operators with := Actually it's not the simple, not at the character level anyway. Even using a parser, there will be ambiguities. > Incidentally, Python has many convenient features that could easily be > added to C, e.g. multiple comparisons behave correctly (a < b > c etc); > array and string slicing e.g. s[4:7] as a shortcut for strndup(s+4,3); > else clauses on loops; and many more. Unfortunately the current fashion > seems to be to try to preserve C in aspic. As far as syntax is concerned, that's true. Even the spin-off languages (even the latest Dart) have virtually the same 40-year-old syntax. And strangely those languages haven't taken the opportunity to change "=" to ":=". -- Bartc
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2011-11-09 13:31 -0800 |
| Message-ID | <ln4nydaspw.fsf@nuthaus.mib.org> |
| In reply to | #12976 |
"BartC" <bc@freeuk.com> writes:
> "Edward Rutherford" <edward.p.rutherford79@REMOVETHIS.gmail.com> wrote
> in message news:j9eceq$jb3$1@speranza.aioe.org...
[...]
> Also it would be necessary to partition C between old C, and new C
> (equivalent of versions 2.x and 3.x), and to maintain that strict
> delineation. With C sources appearing everywhere on the internet, it
> would be a nightmare. Effectively you would be creating a new
> language. It wouldn't be worth the trouble unless you tidied up a few
> other things too, and then you really would have a new language.
There's no shortage of new languages. I have no objection at all to
ceating a new C-like language that uses ":=" for assignment and "==" for
equality. It just can't practically be a replacement for C, and it
shouldn't be called "C".
>> It would be a simple matter to write a converter that read a C source
>> file and replaced all = assignment operators with :=
>
> Actually it's not the simple, not at the character level anyway. Even
> using a parser, there will be ambiguities.
With a parser, or even just a lexer, there shouldn't be any ambiguities.
Just tokenize the source and replace every "=" token with a ":=" token.
This assumes, of course, that "=" is changed to ":=" both for
assignments and for initializers. Compound assignments presumably
wouldn't be affected; "+=" would still be "+=", not "+:=".
There might be some odd corner cases involving the preprocessor.
--
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 | Robert Wessel <robertwessel2@yahoo.com> |
|---|---|
| Date | 2011-11-09 15:53 -0600 |
| Message-ID | <k2tlb71ic16h4ajp3i0teabjt35aei8ujt@4ax.com> |
| In reply to | #12983 |
On Wed, 09 Nov 2011 13:31:07 -0800, Keith Thompson <kst-u@mib.org> wrote: >"BartC" <bc@freeuk.com> writes: >> "Edward Rutherford" <edward.p.rutherford79@REMOVETHIS.gmail.com> wrote >> in message news:j9eceq$jb3$1@speranza.aioe.org... >[...] >> Also it would be necessary to partition C between old C, and new C >> (equivalent of versions 2.x and 3.x), and to maintain that strict >> delineation. With C sources appearing everywhere on the internet, it >> would be a nightmare. Effectively you would be creating a new >> language. It wouldn't be worth the trouble unless you tidied up a few >> other things too, and then you really would have a new language. > >There's no shortage of new languages. I have no objection at all to >ceating a new C-like language that uses ":=" for assignment and "==" for >equality. It just can't practically be a replacement for C, and it >shouldn't be called "C". > >>> It would be a simple matter to write a converter that read a C source >>> file and replaced all = assignment operators with := >> >> Actually it's not the simple, not at the character level anyway. Even >> using a parser, there will be ambiguities. > >With a parser, or even just a lexer, there shouldn't be any ambiguities. >Just tokenize the source and replace every "=" token with a ":=" token. >This assumes, of course, that "=" is changed to ":=" both for >assignments and for initializers. Compound assignments presumably >wouldn't be affected; "+=" would still be "+=", not "+:=". > >There might be some odd corner cases involving the preprocessor. Indeed: #define qq(x) "a" #x "b" char s[]=qq(=); Perhaps a somewhat contrived example, but still representative of a class of potential problems for an automated conversion.
[toc] | [prev] | [next] | [standalone]
| From | "BartC" <bc@freeuk.com> |
|---|---|
| Date | 2011-11-09 22:02 +0000 |
| Message-ID | <j9etan$qig$1@dont-email.me> |
| In reply to | #12983 |
"Keith Thompson" <kst-u@mib.org> wrote in message news:ln4nydaspw.fsf@nuthaus.mib.org... > "BartC" <bc@freeuk.com> writes: >> "Edward Rutherford" <edward.p.rutherford79@REMOVETHIS.gmail.com> wrote >>> It would be a simple matter to write a converter that read a C source >>> file and replaced all = assignment operators with := >> >> Actually it's not [that] simple, not at the character level anyway. Even >> using a parser, there will be ambiguities. > > With a parser, or even just a lexer, there shouldn't be any ambiguities. > Just tokenize the source and replace every "=" token with a ":=" token. > This assumes, of course, that "=" is changed to ":=" both for > assignments and for initializers. OK, that means a lexer will do instead of a parser. Although it will look odd for static initialisers because ":=" looks more of a dynamic, runtime assignment than a passive "=". (But more of an oddity would be having a language that uses ":=" for assignment, but doesn't let you use "=" for equality; you have to still use "==".) > Compound assignments presumably > wouldn't be affected; "+=" would still be "+=", not "+:=". > There might be some odd corner cases involving the preprocessor. What about commented-out code, or (rarer) code fragments inside literals? -- Bartc
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2011-11-09 14:14 -0800 |
| Message-ID | <lnehxh9c50.fsf@nuthaus.mib.org> |
| In reply to | #12990 |
"BartC" <bc@freeuk.com> writes:
[...]
>> There might be some odd corner cases involving the preprocessor.
>
> What about commented-out code, or (rarer) code fragments inside literals?
It would have to be left alone. An automated tool should not make
assumptions about the meaning of text in comments or string literals.
Any tools that generate C code (and there are a *lot* of them)
would have to be modified as well, probably with an option to
generate old-style or new-style assignment operators.
--
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 | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2011-11-09 13:50 -0800 |
| Message-ID | <lnvcqt9d9l.fsf@nuthaus.mib.org> |
| In reply to | #12975 |
Edward Rutherford <edward.p.rutherford79@REMOVETHIS.gmail.com> writes:
> Keith Thompson wrote:
>> Edward Rutherford <edward.p.rutherford79@REMOVETHIS.gmail.com> writes:
>>> Keith Thompson wrote:
>> [...]
>>>> Using "=" for assignment was not, in my opinion, a good idea. Any
>>>> attempt to change it now would be far worse.
>>>
>>> With this attitude, the language will never improve!
>>
>> With any other attitude, the language will die.
>>
>> If you think that changing the C language to use ":=" rather than for
>> assignment is a good idea, that's not an unreasonable opinion, at least
>> at first glance. Frankly, I *wish* I could agree. But if you want to
>> propose such a change and have it taken seriously, you need to address
>> the problems it could cause (as I did in my previous message).
>>
>> So tell us, how would you address the problem of existing code that uses
>> "=" for assignment, and of new code using ":=" for assignment that would
>> no longer compile with older compilers? Similarly, how would you
>> address the legions of C programmers who believe (rightly or wrongly)
>> that using "=" for assignment and "==" for equality is ok, and doesn't
>> need to be fixed?
>>
>> Please be specific.
>
> Python has dealt with this problem very successfully, Kieth: see http://
> www.python.org/dev/peps/pep-0005/ for some general approaches, but also
> http://docs.python.org/release/3.0/whatsnew/3.0.html for details about
> transitioning to "the first ever intentionally backwards incompatible
> Python release".
>
> One of the key planks supporting upgrades to Python 3.0 is an automated
> conversion tool, 2to3 (http://docs.python.org/release/3.0/
> library/2to3.html#to3-reference), which automatically upgrades 2.x source
> code to valid 3.0 Python syntax.
>
> It would be a simple matter to write a converter that read a C source
> file and replaced all = assignment operators with :=
Ok, that's not a bad answer. I still don't think that it would be
at all practical to change C's assignment operator from "=" to ":=".
The overhead would be substantial, probably enough to cause many
implementers and programmers to ignore any new standard that made
such a change. (Getting C99 adopted has been difficult enough.)
C programming culture is not Python programming culture. And I'll
note that Python 2 is not dying with the introduction of Python 3.
> Incidentally, Python has many convenient features that could easily be
> added to C, e.g. multiple comparisons behave correctly (a < b > c etc);
> array and string slicing e.g. s[4:7] as a shortcut for strndup(s+4,3);
> else clauses on loops; and many more. Unfortunately the current fashion
> seems to be to try to preserve C in aspic.
"a < b > c" already has a meaning in C; it's equivalent to
"(a < b) > c", where "(a < b)" yields either 0 or 1. I suspect
that such constructs are used in error more often than they're used
correctly, but the committee is rightly hesitant to make changes
that can break existing code. And it's not *that* hard to write
"a < b && b > c".
I can't think of a way to define "s[4:7]" consistently in C without
radically changing the way C deals with strings and arrays. Suppose
s is a string with the value "Hello, world"; it's represented as an
array containing those 12 characters followed by a terminating '\0'.
s[4:7] should be the string "o, w", but that requires building an
array somewhere in memory with a '\0' immediately following the
'w'; you can't just treat a subset of "Hello, world" as "o, w".
And that means you have to deal with allocating, initializing,
and deallocating it.
I'm not saying that C's string and array handling are an ideal
solution, but there are uncounted millions of lines of code that
depend on it.
As for "preserv[ing] C in aspic", I refer you to
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf, the latest
(?) draft of the upcoming C201X standard. It adds threading,
alignment support, Unicode support, type-generic expressions,
static assertions, optional support for bounds-checking interfaces,
and a number of other things.
--
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 | James Kuyper <jameskuyper@verizon.net> |
|---|---|
| Date | 2011-11-08 07:10 -0500 |
| Message-ID | <j9b66t$7lo$1@dont-email.me> |
| In reply to | #12857 |
On 11/07/2011 05:06 PM, Keith Thompson wrote: ... > Actually, I can think of a way to address the issue without breaking > existing code. (I don't think this would be adopted, and it probably > wouldn't be worth the added complexity.) > > Define ":=" as an alias for "=", the simple assignment operator. > Keep "=" and "==" as they are. Provide an *optional* method > (perhaps a new #pragma) to turn on a warning for any use of "=". I think it would make more sense for use of "=" to become a syntax error if that pragma is turned on. That would mandate a diagnostic, but also give implementations permission to refuse to translate the code. -- James Kuyper
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2011-11-04 14:51 -0700 |
| Message-ID | <lnd3d7ftf3.fsf@nuthaus.mib.org> |
| In reply to | #12687 |
Kaz Kylheku <kaz@kylheku.com> writes:
> 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!
If assignment were a statement rather than an expression, then
accidental assignments like:
if (x = y) /* meant to write if (x == y) */
would be caught by the compiler. (Yes, compilers typically warn about
this.)
--
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] | [standalone]
Page 5 of 5 — ← Prev page 1 2 3 4 [5]
Back to top | Article view | comp.lang.c
csiph-web