Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #2565 > unrolled thread
| Started by | "liebling.kreuzberg@gmail.com" <liebling.kreuzberg@gmail.com> |
|---|---|
| First post | 2011-07-15 14:38 +0000 |
| Last post | 2011-07-18 21:29 +0200 |
| Articles | 14 on this page of 54 — 13 participants |
Back to article view | Back to comp.lang.php
error message I don understand "liebling.kreuzberg@gmail.com" <liebling.kreuzberg@gmail.com> - 2011-07-15 14:38 +0000
Re: error message I don understand Billy Mays <81282ed9a88799d21e77957df2d84bd6514d9af6@myhashismyemail.com> - 2011-07-15 10:44 -0400
Re: error message I don understand "liebling.kreuzberg@gmail.com" <liebling.kreuzberg@gmail.com> - 2011-07-15 17:26 +0000
Re: error message I don understand The Natural Philosopher <tnp@invalid.invalid> - 2011-07-15 18:45 +0100
Re: error message I don understand "liebling.kreuzberg@gmail.com" <liebling.kreuzberg@gmail.com> - 2011-07-15 18:36 +0000
Re: error message I don understand VanguardLH <V@nguard.LH> - 2011-07-15 14:25 -0500
Re: error message I don understand The Natural Philosopher <tnp@invalid.invalid> - 2011-07-15 21:36 +0100
Re: error message I don understand "liebling.kreuzberg@gmail.com" <liebling.kreuzberg@gmail.com> - 2011-07-16 09:17 +0000
Re: error message I don understand The Natural Philosopher <tnp@invalid.invalid> - 2011-07-16 13:52 +0100
Re: error message I don understand Heinrich Käsner <heinkasner@gmail.com> - 2011-08-02 07:02 -0700
Re: error message I don understand The Natural Philosopher <tnp@invalid.invalid> - 2011-07-15 21:35 +0100
Re: error message I don understand Jerry Stuckle <jstucklex@attglobal.net> - 2011-07-16 09:30 -0400
Re: error message I don understand "liebling.kreuzberg@gmail.com" <liebling.kreuzberg@gmail.com> - 2011-07-16 19:14 +0000
Re: error message I don understand The Natural Philosopher <tnp@invalid.invalid> - 2011-07-16 22:18 +0100
Re: error message I don understand The Natural Philosopher <tnp@invalid.invalid> - 2011-07-15 17:49 +0100
Re: error message I don understand "liebling.kreuzberg@gmail.com" <liebling.kreuzberg@gmail.com> - 2011-07-15 17:25 +0000
Re: error message I don understand Denis McMahon <denis.m.f.mcmahon@gmail.com> - 2011-07-16 19:28 +0000
Re: error message I don understand "liebling.kreuzberg@gmail.com" <liebling.kreuzberg@gmail.com> - 2011-07-17 08:21 +0000
Re: error message I don understand Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-07-17 11:10 +0200
Re: error message I don understand The Natural Philosopher <tnp@invalid.invalid> - 2011-07-17 10:20 +0100
Re: error message I don understand Jerry Stuckle <jstucklex@attglobal.net> - 2011-07-17 09:01 -0400
Re: error message I don understand Jerry Stuckle <jstucklex@attglobal.net> - 2011-07-17 09:00 -0400
Re: error message I don understand Denis McMahon <denis.m.f.mcmahon@gmail.com> - 2011-07-17 14:53 +0000
Re: error message I don understand dougatmilmacdotcom@example.com (Doug Miller) - 2011-07-17 16:26 +0000
Re: error message I don understand "liebling.kreuzberg@gmail.com" <liebling.kreuzberg@gmail.com> - 2011-07-18 16:11 +0000
Re: error message I don understand Denis McMahon <denis.m.f.mcmahon@gmail.com> - 2011-07-17 14:52 +0000
Re: error message I don understand Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-07-18 17:19 +0200
Re: error message I don understand The Natural Philosopher <tnp@invalid.invalid> - 2011-07-18 17:01 +0100
Re: error message I don understand "liebling.kreuzberg@gmail.com" <liebling.kreuzberg@gmail.com> - 2011-07-18 16:07 +0000
Re: error message I don understand Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-07-18 18:27 +0200
Re: error message I don understand "liebling.kreuzberg@gmail.com" <liebling.kreuzberg@gmail.com> - 2011-07-18 20:12 +0000
Re: error message I don understand August Karlstrom <fusionfile@gmail.com> - 2011-07-17 14:55 +0200
Re: error message I don understand Jerry Stuckle <jstucklex@attglobal.net> - 2011-07-17 09:03 -0400
Re: error message I don understand August Karlstrom <fusionfile@gmail.com> - 2011-07-17 16:50 +0200
Re: error message I don understand Jerry Stuckle <jstucklex@attglobal.net> - 2011-07-17 12:26 -0400
Re: error message I don understand "Peter H. Coffin" <hellsop@ninehells.com> - 2011-07-17 11:31 -0500
Nasty language semantics (Was: error message I don understand) August Karlstrom <fusionfile@gmail.com> - 2011-07-17 19:47 +0200
Re: Nasty language semantics (Was: error message I don understand) Jerry Stuckle <jstucklex@attglobal.net> - 2011-07-17 14:12 -0400
Re: Nasty language semantics (Was: error message I don understand) Robert Heller <heller@deepsoft.com> - 2011-07-17 13:26 -0500
Re: Nasty language semantics (Was: error message I don understand) Tim Streater <timstreater@greenbee.net> - 2011-07-17 20:23 +0100
Re: Nasty language semantics (Was: error message I don understand) The Natural Philosopher <tnp@invalid.invalid> - 2011-07-17 20:50 +0100
Re: Nasty language semantics (Was: error message I don understand) Robert Heller <heller@deepsoft.com> - 2011-07-17 15:17 -0500
Re: Nasty language semantics (Was: error message I don understand) The Natural Philosopher <tnp@invalid.invalid> - 2011-07-17 21:21 +0100
Re: Nasty language semantics Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-07-18 18:17 +0200
Re: Nasty language semantics (Was: error message I don understand) Tim Streater <timstreater@greenbee.net> - 2011-07-17 23:06 +0100
Re: Nasty language semantics (Was: error message I don understand) August Karlstrom <fusionfile@gmail.com> - 2011-07-18 00:48 +0200
Re: Nasty language semantics (Was: error message I don understand) Jerry Stuckle <jstucklex@attglobal.net> - 2011-07-17 19:23 -0400
Re: Nasty language semantics (Was: error message I don understand) August Karlstrom <fusionfile@gmail.com> - 2011-07-18 01:51 +0200
Re: Nasty language semantics (Was: error message I don understand) Jerry Stuckle <jstucklex@attglobal.net> - 2011-07-17 21:18 -0400
Re: Nasty language semantics (Was: error message I don understand) Tim Streater <timstreater@greenbee.net> - 2011-07-18 09:22 +0100
Re: Nasty language semantics (Was: error message I don understand) "Peter H. Coffin" <hellsop@ninehells.com> - 2011-07-18 10:57 -0500
Re: error message I don understand Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-07-18 17:55 +0200
Nasty language semantics (Was: error message I don understand) August Karlstrom <fusionfile@gmail.com> - 2011-07-18 20:31 +0200
Re: Nasty language semantics Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-07-18 21:29 +0200
Page 3 of 3 — ← Prev page 1 2 [3]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2011-07-17 20:50 +0100 |
| Subject | Re: Nasty language semantics (Was: error message I don understand) |
| Message-ID | <ivvee0$eqg$1@news.albasani.net> |
| In reply to | #2599 |
Tim Streater wrote: > In article <ivv775$egh$1@dont-email.me>, > August Karlstrom <fusionfile@gmail.com> wrote: > >> On 2011-07-17 18:31, Peter H. Coffin wrote: >> > On Sun, 17 Jul 2011 16:50:28 +0200, August Karlstrom wrote: >> > >> >> On 2011-07-17 15:03, Jerry Stuckle wrote: >> >> >> >>> This isn't mathematics - it is programming, as people have told you >> >>> before. If you want mathematics, get a chalkboard. >> >> >> >> Don't be silly. There are several programming languages in which `=' >> >> denote (surprise) equality. >> > >> > Very few that use it alone. >> >> Pascal, Modula-2, Eiffel and Ada all use `=' for equality and `:=' for >> assignment. > > A good enough reason not to use these languages. > The chief reason I gave up on Pascal after spending 4 hours trying to make a variable length bitfield containing potentially different sorts of entities depending on what was in the first few bits...into some form of syntax that made it usable, was that in the end rewriting the whole program in C was quicker than trying to make the existing Pascal work. And that's the problem with these academic languages. When you meet a situation never envisaged in the academics brain that created them, you are basically shafted. I don't care what the actual syntax is. AS long as its clear unambiguous and consistent. Since I write assignment more often than comparisons, I slightly prefer a=b as the assignment and a==b as the boolean comparison. Aso why I hate loosely typed languages. I want to know that '1.02' + '3.7' is reliably going to be either '4.72' or '1.023.7', not implementation dependent, as I found in at least one Javascript example.
[toc] | [prev] | [next] | [standalone]
| From | Robert Heller <heller@deepsoft.com> |
|---|---|
| Date | 2011-07-17 15:17 -0500 |
| Subject | Re: Nasty language semantics (Was: error message I don understand) |
| Message-ID | <76idnXX5CP7_3r7TnZ2dnUVZ_rGdnZ2d@posted.localnet> |
| In reply to | #2600 |
At Sun, 17 Jul 2011 20:50:23 +0100 The Natural Philosopher <tnp@invalid.invalid> wrote:
>
> Tim Streater wrote:
> > In article <ivv775$egh$1@dont-email.me>,
> > August Karlstrom <fusionfile@gmail.com> wrote:
> >
> >> On 2011-07-17 18:31, Peter H. Coffin wrote:
> >> > On Sun, 17 Jul 2011 16:50:28 +0200, August Karlstrom wrote:
> >> >
> >> >> On 2011-07-17 15:03, Jerry Stuckle wrote:
> >> >>
> >> >>> This isn't mathematics - it is programming, as people have told you
> >> >>> before. If you want mathematics, get a chalkboard.
> >> >>
> >> >> Don't be silly. There are several programming languages in which `='
> >> >> denote (surprise) equality.
> >> >
> >> > Very few that use it alone.
> >>
> >> Pascal, Modula-2, Eiffel and Ada all use `=' for equality and `:=' for
> >> assignment.
> >
> > A good enough reason not to use these languages.
> >
>
> The chief reason I gave up on Pascal after spending 4 hours trying to
> make a variable length bitfield containing potentially different sorts
> of entities depending on what was in the first few bits...into some form
> of syntax that made it usable, was that in the end rewriting the whole
> program in C was quicker than trying to make the existing Pascal work.
>
> And that's the problem with these academic languages. When you meet a
> situation never envisaged in the academics brain that created them, you
> are basically shafted.
>
> I don't care what the actual syntax is. AS long as its clear unambiguous
> and consistent.
>
>
> Since I write assignment more often than comparisons, I slightly prefer
> a=b as the assignment and a==b as the boolean comparison.
>
> Aso why I hate loosely typed languages.
>
> I want to know that '1.02' + '3.7' is reliably going to be either '4.72'
> or '1.023.7', not implementation dependent, as I found in at least one
> Javascript example.
Javascript's main problem here is using a common numerical operator (+)
as a string operator as will AND allowing numbers to promoted (or
demoted) to strings. Javascript *could* have picked a different
operator for string concatenation, something less likely to cause
ambigious interpretation.
>
--
Robert Heller -- 978-544-6933 / heller@deepsoft.com
Deepwoods Software -- http://www.deepsoft.com/
() ascii ribbon campaign -- against html e-mail
/\ www.asciiribbon.org -- against proprietary attachments
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2011-07-17 21:21 +0100 |
| Subject | Re: Nasty language semantics (Was: error message I don understand) |
| Message-ID | <ivvg7e$ijm$1@news.albasani.net> |
| In reply to | #2601 |
Robert Heller wrote: > At Sun, 17 Jul 2011 20:50:23 +0100 The Natural Philosopher <tnp@invalid.invalid> wrote: > >> Tim Streater wrote: >>> In article <ivv775$egh$1@dont-email.me>, >>> August Karlstrom <fusionfile@gmail.com> wrote: >>> >>>> On 2011-07-17 18:31, Peter H. Coffin wrote: >>>>> On Sun, 17 Jul 2011 16:50:28 +0200, August Karlstrom wrote: >>>>> >>>>>> On 2011-07-17 15:03, Jerry Stuckle wrote: >>>>>> >>>>>>> This isn't mathematics - it is programming, as people have told you >>>>>>> before. If you want mathematics, get a chalkboard. >>>>>> Don't be silly. There are several programming languages in which `=' >>>>>> denote (surprise) equality. >>>>> Very few that use it alone. >>>> Pascal, Modula-2, Eiffel and Ada all use `=' for equality and `:=' for >>>> assignment. >>> A good enough reason not to use these languages. >>> >> The chief reason I gave up on Pascal after spending 4 hours trying to >> make a variable length bitfield containing potentially different sorts >> of entities depending on what was in the first few bits...into some form >> of syntax that made it usable, was that in the end rewriting the whole >> program in C was quicker than trying to make the existing Pascal work. >> >> And that's the problem with these academic languages. When you meet a >> situation never envisaged in the academics brain that created them, you >> are basically shafted. >> >> I don't care what the actual syntax is. AS long as its clear unambiguous >> and consistent. >> >> >> Since I write assignment more often than comparisons, I slightly prefer >> a=b as the assignment and a==b as the boolean comparison. >> >> Aso why I hate loosely typed languages. >> >> I want to know that '1.02' + '3.7' is reliably going to be either '4.72' >> or '1.023.7', not implementation dependent, as I found in at least one >> Javascript example. > > Javascript's main problem here is using a common numerical operator (+) > as a string operator as will AND allowing numbers to promoted (or > demoted) to strings. Javascript *could* have picked a different > operator for string concatenation, something less likely to cause > ambigious interpretation. > Or they could have defined the language carefully enough so that it was unambiguous, or allowed for explicit casting to make it so. >> >
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2011-07-18 18:17 +0200 |
| Subject | Re: Nasty language semantics |
| Message-ID | <8862364.SEqChMirdb@PointedEars.de> |
| In reply to | #2601 |
Robert Heller wrote: > The Natural Philosopher wrote: >> I want to know that '1.02' + '3.7' is reliably going to be either '4.72' >> or '1.023.7', not implementation dependent, as I found in at least one >> Javascript example. To the best of my knowledge there is no such non-conforming ECMAScript implementation. You (or the author of the example) must have been doing something else wrong. > Javascript's main problem here is using a common numerical operator (+) > as a string operator as will AND allowing numbers to promoted (or > demoted) to strings. Javascript *could* have picked a different > operator for string concatenation, something less likely to cause > ambigious interpretation. There is no "Javascript"¹. If you think about this, it would have been rather difficult for the designer of JavaScript (and, as a consequence, the ECMAScript committee) to choose another operator for concatenation that was widely accepted, given that he needed the language to resemble Java (hence the name, changed from LiveScript). They could not use today's PHP's `.', because that was already taken for property access by Java (where PHP has the C++-ish `->' instead). They could not use `<<' etc, because that was used for SHL/SHR already. And they could not have skipped the implicit type conversion because the language needed to be loosely typed (one design goal was a language that was flexible, and easy to use, compared to Java). I wouldn't mind if they chose C++/Python's optional whitespace operator for concatenating string literals (that would have made writing/reading long strings in source code considerably easier), and PHP's variable expansion mechanism or Python's sprintf() mechanism (`%') for dealing with "concatenation" of non-string values (IIRC, efforts for built-in string templates in JavaScript 2.0 are underway). (`%' would have been ambiguous, though, and might have meant a unwanted diversion from Java by introduction of a `mod' operator instead.) PointedEars ___________ ¹ <http://PointedEars.de/es-matrix> -- Danny Goodman's books are out of date and teach practices that are positively harmful for cross-browser scripting. -- Richard Cornford, cljs, <cife6q$253$1$8300dec7@news.demon.co.uk> (2004)
[toc] | [prev] | [next] | [standalone]
| From | Tim Streater <timstreater@greenbee.net> |
|---|---|
| Date | 2011-07-17 23:06 +0100 |
| Subject | Re: Nasty language semantics (Was: error message I don understand) |
| Message-ID | <timstreater-955B7D.23061017072011@news.individual.net> |
| In reply to | #2600 |
In article <ivvee0$eqg$1@news.albasani.net>, The Natural Philosopher <tnp@invalid.invalid> wrote: > Tim Streater wrote: > > In article <ivv775$egh$1@dont-email.me>, > > August Karlstrom <fusionfile@gmail.com> wrote: > > > >> On 2011-07-17 18:31, Peter H. Coffin wrote: > >> > On Sun, 17 Jul 2011 16:50:28 +0200, August Karlstrom wrote: > >> > > >> >> On 2011-07-17 15:03, Jerry Stuckle wrote: > >> >> > >> >>> This isn't mathematics - it is programming, as people have told you > >> >>> before. If you want mathematics, get a chalkboard. > >> >> > >> >> Don't be silly. There are several programming languages in which `=' > >> >> denote (surprise) equality. > >> > > >> > Very few that use it alone. > >> > >> Pascal, Modula-2, Eiffel and Ada all use `=' for equality and `:=' for > >> assignment. > > > > A good enough reason not to use these languages. > > The chief reason I gave up on Pascal after spending 4 hours trying to > make a variable length bitfield containing potentially different sorts > of entities depending on what was in the first few bits...into some form > of syntax that made it usable, was that in the end rewriting the whole > program in C was quicker than trying to make the existing Pascal work. > > And that's the problem with these academic languages. When you meet a > situation never envisaged in the academics brain that created them, you > are basically shafted. Pascal was not originally intended for other than academic use. As designed and implemented by Wirth, you couldn't even do compilation of separate modules for later linking together. Trouble is, students who learnt it then decided it was wonderful, went out into the wide world, and persuaded clueless software managers that this was the language to make more widely available. Its worst defect was that strings of different lengths were different types. Also at the time academics were pushing the single-entry-single-exit bullshit, so there was no return statement. It ended up as a plethora of different implementations, all getting around the limitations in different incompatible ways, which is probably what did for it. -- Tim "That excessive bail ought not to be required, nor excessive fines imposed, nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
[toc] | [prev] | [next] | [standalone]
| From | August Karlstrom <fusionfile@gmail.com> |
|---|---|
| Date | 2011-07-18 00:48 +0200 |
| Subject | Re: Nasty language semantics (Was: error message I don understand) |
| Message-ID | <ivvorv$19k$1@dont-email.me> |
| In reply to | #2603 |
On 2011-07-18 00:06, Tim Streater wrote: > Also at the time academics were pushing the > single-entry-single-exit bullshit, so there was no return statement. I guess a certain level of maturity is required to appreciate some of these "restrictions". The return statement goes against the idea of a truly structured goto-less programming language. Wirth introduced the return statement (tried it) in Modula-2 and in the first versions of Oberon but replaced it with a return clause (single exit point) in Oberon-07. Here is a quote by Niklaus Wirth from "Differences between Oberon-07 and Oberon"*: "The result of a function procedure was specified by a return statement. This form has the unpleasant property that the return statement is syntactically disconnected from the function procedure declaration, similar to the exit from the loop statements. It is therefore difficult to check, whether or not a function procedure declaration specifies a result, or perhaps even several of them. Now the result specification becomes syntactically a part of the procedure declaration, and vanishes as an independent statement form." August *http://www.inf.ethz.ch/personal/wirth/Articles/Oberon/Oberon07.pdf -- The competent programmer is fully aware of the limited size of his own skull. He therefore approaches his task with full humility, and avoids clever tricks like the plague. --Edsger Dijkstra
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2011-07-17 19:23 -0400 |
| Subject | Re: Nasty language semantics (Was: error message I don understand) |
| Message-ID | <ivvqsk$fmp$1@dont-email.me> |
| In reply to | #2604 |
On 7/17/2011 6:48 PM, August Karlstrom wrote: > On 2011-07-18 00:06, Tim Streater wrote: >> Also at the time academics were pushing the >> single-entry-single-exit bullshit, so there was no return statement. > > I guess a certain level of maturity is required to appreciate some of > these "restrictions". The return statement goes against the idea of a > truly structured goto-less programming language. Wirth introduced the > return statement (tried it) in Modula-2 and in the first versions of > Oberon but replaced it with a return clause (single exit point) in > Oberon-07. Here is a quote by Niklaus Wirth from "Differences between > Oberon-07 and Oberon"*: > <snip> > > > August > > > *http://www.inf.ethz.ch/personal/wirth/Articles/Oberon/Oberon07.pdf > I guess a certain level of maturity is needed to recognize an academic language from one which is truly usable in the real world. My guess is you've never worked on a real multi-programmer project in a business environment. Or maybe not even a single-programmer project in a corporate environment. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | August Karlstrom <fusionfile@gmail.com> |
|---|---|
| Date | 2011-07-18 01:51 +0200 |
| Subject | Re: Nasty language semantics (Was: error message I don understand) |
| Message-ID | <ivvsic$otv$1@dont-email.me> |
| In reply to | #2605 |
On 2011-07-18 01:23, Jerry Stuckle wrote: > I guess a certain level of maturity is needed to recognize an academic > language from one which is truly usable in the real world. > > My guess is you've never worked on a real multi-programmer project in a > business environment. Or maybe not even a single-programmer project in a > corporate environment. I have worked in all kinds of constellations and seldom have I experienced a problem with the language at hand being too restrictive, quite on the contrary, obscure language features in combination with programmer "cleverness" (in the usual "power corrupts" sense) have given rise to several maintenance headaches. August -- The competent programmer is fully aware of the limited size of his own skull. He therefore approaches his task with full humility, and avoids clever tricks like the plague. --Edsger Dijkstra
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2011-07-17 21:18 -0400 |
| Subject | Re: Nasty language semantics (Was: error message I don understand) |
| Message-ID | <j001kt$k3b$1@dont-email.me> |
| In reply to | #2606 |
On 7/17/2011 7:51 PM, August Karlstrom wrote: > On 2011-07-18 01:23, Jerry Stuckle wrote: >> I guess a certain level of maturity is needed to recognize an academic >> language from one which is truly usable in the real world. >> >> My guess is you've never worked on a real multi-programmer project in a >> business environment. Or maybe not even a single-programmer project in a >> corporate environment. > > I have worked in all kinds of constellations and seldom have I > experienced a problem with the language at hand being too restrictive, > quite on the contrary, obscure language features in combination with > programmer "cleverness" (in the usual "power corrupts" sense) have given > rise to several maintenance headaches. > > August > What a way to sidestep the question. You just confirmed my hypothesis. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Tim Streater <timstreater@greenbee.net> |
|---|---|
| Date | 2011-07-18 09:22 +0100 |
| Subject | Re: Nasty language semantics (Was: error message I don understand) |
| Message-ID | <timstreater-214F96.09225818072011@news.individual.net> |
| In reply to | #2604 |
In article <ivvorv$19k$1@dont-email.me>, August Karlstrom <fusionfile@gmail.com> wrote: > On 2011-07-18 00:06, Tim Streater wrote: > > Also at the time academics were pushing the > > single-entry-single-exit bullshit, so there was no return statement. > > I guess a certain level of maturity is required to appreciate some of > these "restrictions". The return statement goes against the idea of a > truly structured goto-less programming language. Wirth introduced the > return statement (tried it) in Modula-2 and in the first versions of > Oberon but replaced it with a return clause (single exit point) in > Oberon-07. Here is a quote by Niklaus Wirth from "Differences between > Oberon-07 and Oberon"*: > > "The result of a function procedure was specified by a return statement. > This form has the unpleasant property that the return statement is > syntactically disconnected from the function procedure declaration, > similar to the exit from the loop statements. It is therefore difficult > to check, whether or not a function procedure declaration specifies a > result, or perhaps even several of them. Now the result specification > becomes syntactically a part of the procedure declaration, and vanishes > as an independent statement form." Mmm, and code becomes unreadable as a result, with lots of extra if-else nesting to try to ensure that from a given point where I would do a return, no more code is going to be executed in the function. Unreadable because I have to spend a long time convincing myself that no more code will, in fact, be executed. I haven't used a goto since 1978 when I gave up writing FORTRAN. Oh wait, tell a lie, there was a period when I had to, since I was obliged to write in Pascal and there was no return statement. So I faked one by labelling the end of the function with 999: and then doing goto 999. Thank God that piece of impractical nonsense has gone the way of the Dodo. Early return simplifies code; I regard it as my responsibility to ensure I return the right thing. -- Tim "That excessive bail ought not to be required, nor excessive fines imposed, nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
[toc] | [prev] | [next] | [standalone]
| From | "Peter H. Coffin" <hellsop@ninehells.com> |
|---|---|
| Date | 2011-07-18 10:57 -0500 |
| Subject | Re: Nasty language semantics (Was: error message I don understand) |
| Message-ID | <slrnj28lvg.207.hellsop@nibelheim.ninehells.com> |
| In reply to | #2609 |
On Mon, 18 Jul 2011 09:22:58 +0100, Tim Streater wrote:
> I haven't used a goto since 1978 when I gave up writing FORTRAN. Oh
> wait, tell a lie, there was a period when I had to, since I was obliged
> to write in Pascal and there was no return statement. So I faked one by
> labelling the end of the function with 999: and then doing goto 999.
Something of Pyrrhic victory, some might say...
--
7. When I've captured my adversary and he says, "Look, before you kill
me, will you at least tell me what this is all about?" I'll say,
"No." and shoot him. On second thought I'll shoot him then say "No."
--Peter Anspach's list of things to do as an Evil Overlord
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2011-07-18 17:55 +0200 |
| Message-ID | <1530422.qVoOGUtdWV@PointedEars.de> |
| In reply to | #2591 |
August Karlstrom wrote: > On 2011-07-17 15:03, Jerry Stuckle wrote: >> On 7/17/2011 8:55 AM, August Karlstrom wrote: >>> It is a very easy mistake to do if you are used to saner programming >>> languages in which `=' has the standard mathematical meaning (this >>> symbol has been used in mathematics to denote equality for some 500 >>> years). >> This isn't mathematics - it is programming, as people have told you >> before. If you want mathematics, get a chalkboard. > > Don't be silly. There are several programming languages in which `=' > denote (surprise) equality. And I have found all programs written in any of those programming languages to be more difficult to maintain than the rest. One such language is VBScript (which is particularly bad designed in other respects as well). It is no coincidence that all modern higher-level programming languages make a syntactical and not only a contextual difference between assignment and comparison (`=' means comparison in a VBScript `If' statement, but assignment in a standalone VBScript statement – why?), and that older ones tend to do not (but speaking of math, even Pascal, arguably one of the older ones, has `:=' and `=', respectively): Intelligent life is distinguished by its ability to learn from past mistakes. For this is not only a maintenance problem; it also makes compiling such source code more complicated as the underlying grammar ends up being ambiguous. I would always consider it a result of bad language design for a (built-in) operator to have such very different meanings. PointedEars -- Prototype.js was written by people who don't know javascript for people who don't know javascript. People who don't know javascript are not the best source of advice on designing systems that use javascript. -- Richard Cornford, cljs, <f806at$ail$1$8300dec7@news.demon.co.uk>
[toc] | [prev] | [next] | [standalone]
| From | August Karlstrom <fusionfile@gmail.com> |
|---|---|
| Date | 2011-07-18 20:31 +0200 |
| Subject | Nasty language semantics (Was: error message I don understand) |
| Message-ID | <j01u5e$e5q$1@dont-email.me> |
| In reply to | #2615 |
On 2011-07-18 17:55, Thomas 'PointedEars' Lahn wrote: > August Karlstrom wrote: >> Don't be silly. There are several programming languages in which `=' >> denote (surprise) equality. > > And I have found all programs written in any of those programming languages > to be more difficult to maintain than the rest. One such language is > VBScript (which is particularly bad designed in other respects as well). That's because they have been badly designed in other respects as you mention. > It is no coincidence that all modern higher-level programming languages make > a syntactical and not only a contextual difference between assignment and > comparison Yes, that is a good thing. > I would always consider it a result of bad language design for a (built-in) > operator to have such very different meanings. Agreed. The assignment symbol should ideally be a left arrow but as we all know it is not available on a standard keyboard or in the ASCII character set. I think `:=' is a reasonable alternative. August -- The competent programmer is fully aware of the limited size of his own skull. He therefore approaches his task with full humility, and avoids clever tricks like the plague. --Edsger Dijkstra
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2011-07-18 21:29 +0200 |
| Subject | Re: Nasty language semantics |
| Message-ID | <3103701.jcOgjVbhT3@PointedEars.de> |
| In reply to | #2622 |
August Karlstrom wrote:
> On 2011-07-18 17:55, Thomas 'PointedEars' Lahn wrote:
>> August Karlstrom wrote:
>>> Don't be silly. There are several programming languages in which `='
>>> denote (surprise) equality.
>> And I have found all programs written in any of those programming
>> languages to be more difficult to maintain than the rest. One such
>> language is VBScript (which is particularly bad designed in other
>> respects as well).
>
> That's because they have been badly designed in other respects as you
> mention.
NAK.
>> I would always consider it a result of bad language design for a
>> (built-in) operator to have such very different meanings.
>
> Agreed. The assignment symbol should ideally be a left arrow
NAK. As was said before, this is programming, not math.
> but as we all know it is not available on a standard keyboard or in the
> ASCII character set. I think `:=' is a reasonable alternative.
So are `=', `==' and `===', if only for keeping the well-established C
tradition (which makes it easier to learn yet another programming language,
mind you).
But there is another option: a compiler could disallow or warn about
assignment in conditional expressions if it was not obvious that this was
intended (as indicated by another pair of parentheses around the
assignment). AFAIK, the Java compiler (javac) and the Mozilla JavaScript
Validator include a switch to generate a warning. PHP's JIT-compiler SHOULD
also do this with the E_WARNING or E_COMPILE_WARNING bits set (but PHP
5.3.3-7+squeeze3 with Suhosin-Patch (cli) does not.)
PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
[toc] | [prev] | [standalone]
Page 3 of 3 — ← Prev page 1 2 [3]
Back to top | Article view | comp.lang.php
csiph-web