|
On 20/05/2011, at 11:20 AM, Frédéric Trottier-Hébert wrote: > I don't agree with complaints either -- I have no issue with Erlang's syntax, lisp/scheme/racket's syntax or any other language. The reality, however, is that while programmers can pick up Erlang's syntax quickly, there's still an initial struggle to break what has been committed to muscle memory by many of the people I have taught it to. Perhaps the biggest obstacle might be that = does not mean assignment, or else that alphabetic case *does* matter but cannot be chosen freely. Neither of which is something I'd change. _______________________________________________ erlang-questions mailing list [hidden email] http://erlang.org/mailman/listinfo/erlang-questions |
|
In reply to this post by Steve Strong
"... looking at both backward *and* forward compatibility issues (what sort of things might this change prevent us from doing in the future?)"
I have repeatedly asked people here what this change would break, and in particular how it might compromise backward compatibility. Nobody has answered, so far. Since the change amounts to the compiler silently inserting a function name during parsing at points where some IDE environments already already insert the name literally when you type ";", it's pretty hard to see how there could be a backward compatibility issue.
As for forward compatibility, we have it from Joe that syntax changes hardly every happen anyway. So if change is very unlikely to happen, forward compatiblity isn't much of an issue either, is it?
As for how many meetings it would take Ericsson to establish that the risk is low/zero, well, OK, got me: I've worked as a software engineer in a couple of large companies, so I know that these things can take time. In fact, I remember life at one networking company where any single engineering change order to the production system required no fewer than 25 signatures. So you may have a point there. (Although I thought part of the point of open source was to circumvent that kind of bureaucratic tarpit. Guess I was wrong.)
"Emacs for one would need work since it's syntax highlighting would now be broken."
It would only be broken for any code that took advantage of the change I suggest. Which would start out at exactly zero percent of the Erlang code out there. As the supposed "harm" grew, well, somebody would go and modify whatever needed to be modified, to make syntax highlighting work as it does in Emacs already for the analogous syntax in Clojure. "If this is so important to you ...." It is not that important to me (at the moment.) However, like anybody else, I hate having my case for change twisted by others, and I hate objections to ideas (mine and others) when the objections don't actually hold water.
If you think the thread is a waste of *your* time, you're free to not contribute to it. -michael turner On Fri, May 20, 2011 at 4:12 PM, Steve Strong <[hidden email]> wrote:
_______________________________________________ erlang-questions mailing list [hidden email] http://erlang.org/mailman/listinfo/erlang-questions |
|
In reply to this post by Richard O'Keefe
"And why do you think I don't use Clojure?"
Uh, Richard, where did he say he thought that? -michael turner On Fri, May 20, 2011 at 5:40 PM, Richard O'Keefe <[hidden email]> wrote:
_______________________________________________ erlang-questions mailing list [hidden email] http://erlang.org/mailman/listinfo/erlang-questions |
|
In reply to this post by Richard O'Keefe
"... because THAT IS COVERED IN THE REFERENCE MANUAL WHERE THE VERY
FIRST THING AFTER THE SECTION HEADING SHOWS A MULTICLAUSE FUN." And (he says, ears ringing slightly) that somehow makes it OK for any other part of the documentation to be wrong, even when your average learner is far more likely to encounter the erroneous passage first?
I eventually ran across the reference manual description.
Thanks for the update about the proportions of time spent scanning vs. parsing. I'm under the influence of something I heard Bill Joy (then a student of Sue Graham's) say about lex and yacc back around 1980 or so. In any case, can we at least agree that the change I suggest is going to have minimal impact on parsing times?
"If both the existing readable alternative and the proposed horrible one are supported, the code *has* to increase in volume, and *has* to become less maintainable." Even if it actually reduces the number of grammar rules, or keeps the number the same, and even if it means the same amount of head-match checking we have now?
"You are attacking one of the features of Erlang that I have found most helpful." I found this "feature" helpful in a way myself: from doing some Prolog programming, I had some experience with writing code in this pattern. But when I was doing Prolog programming, I had the same complaint about Prolog: dreary repetition of redundant identifiers where whitespace and indentation would (I thought) enhance readability. It took some getting used to. But I suppose I could have learned to love it if I'd done more Prolog programming.
We have an eye of the beholder problem, here, obviously. -michael turner 2011/5/20 Richard O'Keefe <[hidden email]>
_______________________________________________ erlang-questions mailing list [hidden email] http://erlang.org/mailman/listinfo/erlang-questions |
|
In reply to this post by Michael Turner
On 19 May 2011 18:47, Michael Turner <[hidden email]> wrote: --
Jumping into the party a bit late, but this caught my eye. You do realize that sometimes people have to look at the code written by others, right? Whether I choose to use this new syntax or not (and for the record I hate it), it will inevitably still impact me if others choose to use it.
"Perhaps people don't believe this, but throughout all of the discussions of entering China our focus has really been what's best for the Chinese people. It's not been about our revenue or profit or whatnot." --Sergey Brin, demonstrating the emptiness of the "don't be evil" mantra. _______________________________________________ erlang-questions mailing list [hidden email] http://erlang.org/mailman/listinfo/erlang-questions |
|
In reply to this post by Richard O'Keefe
Thank you for the clarification. I see now that you had the fun "name" in upper case, in the code sample on the other thread. Perhaps that's enough for most people on this list to infer -- automatically and immediately -- that you really meant "variable" even when you were saying "name". But I've mostly been using regular programming languages for the last 30 years, which offer a little more freedom in variable naming, and I still fail sometimes to automatically think "variable" just because a non-macro identifier starts in upper case -- which is another old Prolog convention I always had trouble with. I apologize for being, um, you know ... merely average?
It's certainly a solution to a problem, I'd like to see it (or something like it) succeed, and I wish you luck with it. -michael turner
On Fri, May 20, 2011 at 4:42 PM, Richard O'Keefe <[hidden email]> wrote:
_______________________________________________ erlang-questions mailing list [hidden email] http://erlang.org/mailman/listinfo/erlang-questions |
|
In reply to this post by Richard O'Keefe
> consider the needs of READERS in preference to WRITERS.
I found this statement nicely summed up the conflicting views on this thread. Very well put. And it puts the issue to rest IMO. - Edmond - On Fri, 20 May 2011 18:27:03 +1000, Richard O'Keefe <[hidden email]> wrote: > > On 19/05/2011, at 4:08 AM, Michael Turner wrote: > >> "Sorry, but Erlang doesn't *need* a better chance of survival." >> >> Now, wait, I'm really pretty sure that, less than a year ago, I saw >> both Peyton-Jones and Armstong in a video, speculating about the future >> of their respective favorite languages, and openly wondering what the >> long-term future held. > > And? Haskell is booming. They tried to avoid success and failed > miserably. > >> In the meantime, I haven't noticed a dramatic increase in the frequency >> of Erlang job postings, though perhaps it's gone up. However, a >> doubling would still leave the number small. > > That does not mean that Erlang is under threat. Come to think of it, R > is booming > also. There are at least 81 mirrors of CRAN to handle the download > volumes. How > many R jobs do you see? >> >> "Changing core language features that are solid,..." >> >> Except that that what I proposes fixes a weak spot (among other >> things): failed syntactic consistency. > > No, it leaves the *weak* spot (the absence of names in funs) along > and smashes the *strong* spot. >> >> "... well thought out ..." >> >> Except that Joe Armstrong has just admitted (on this thread, IIRC) that >> the reason for the inconsistency is that they just didn't think about >> it at the time...." > > If you mean when "funs" were introduced, that may be so. > But the repeated function names were copied from languages where it *WAS* > well thought out, rather like you probably would not fault someone for > designing a programming language using [] for array subscripting. > >> >> "... and non-harmful ..." >> >> Implying that what I suggest here IS harmful? > > Yes, it is > It would seriously impair readability. > It would break several code processing tools that I use. > It would drastically impair the usefulness of every existing Erlang book. >> >> Actually not. No amount of education and experience will make repeating >> the function name with every clause a DRY issue, for those who find >> that repetition as more of an obstacle than otherwise. > > Remember always to consider the needs of READERS in preference to > WRITERS. > > Take Haskell, as an example. One of the advantages of Haskell is that > the > types of functions can be inferred from their bodies (as long as you > stick > to the standard language and don't use the rank 2 extension GHC offers). > Why then do most Haskell programmers recommend writing down function > types > anyway, even though that violates DRY? > > Because although the type *is* implicit in the code, and the *compiler* > can figure it out, that doesn't mean it's easy for *humans*. > > If you are one of the people who find repeating function names an > obstacle > (on present evidence, a set of cardinality one), > - you don't have to use Erlang > - you can always write cases if you want > - you could look into LFE > - you could write your own preprocessor > > >> No amount of education and experience will keep people from wondering, >> "Why this strange inconsistency?" > > As a matter of fact, I've known about Erlang since about a year (maybe > two) since the first paper > on it. Since well before it *had* funs, in fact. And you know, I've > *never* had that thought. > I don't experience any inconsistency. > >> oAnd better documentation and training will only make more people ask >> that question. I didn't ask that question until I *stumbled* on the >> extended syntax for funs; I didn't know about it before. > > "Extended syntax for funs?" What's that? The syntax of funs is > described in > chapter 7 of the reference manual, the chapter on expressions, which is > exactly > where you would expect to find it. > > The inconsistency I see is that functions are OK but funs > (a) do not permit a visible function name > -- just like Haskell, Clean, SML, CAML, &c > (b) begin with "fun" instead of just beginning > -- just like Haskell, Clean, SML, &c > (c) end with "end" instead of ending with a "." > -- the other languages I mentioned do not have any > -- terminator, so I usually find myself having to > -- wrap them in parentheses. It's quite nice not > -- having to do that. > > However, (b) and (c) are unsurprising because funs are > *expressions* and normal function definitions are not. > > If you are that upset about (a), I suggest that the inconsistency > should be resolved by allowing funs to have names, as I've suggested, > because that would fix the *other* difference between funs and > normal functions, which is that normal functions can be directly > recursive, and funs cannot. > > Your proposal to add a definition style that I find horrible for > normal functions fails to do anything about that *other* difference > between functions and funs. > > I repeat, you are urging that a *strong* spot be smashed to make > it consistent with a *weak* spot, which is quite the wrong way around. > > _______________________________________________ > erlang-questions mailing list > [hidden email] > http://erlang.org/mailman/listinfo/erlang-questions -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ _______________________________________________ erlang-questions mailing list [hidden email] http://erlang.org/mailman/listinfo/erlang-questions |
|
Anyone who thinks that I address the needs of writers in preference to readers on this thread hasn't been reading me with much attention. Readability is somewhat in the eye of the beholder. A lot of the beholders on this list are seasoned Erlang programmers. It's pretty clear what they prefer: the way things are.
I happen to find the indented style I propose more readable. I have also said that I think programmers new to Erlang would tend to agree, although without a scientific test it would be hard to establish this, I admit. Some day, if Erlang survives, all the eyes on it will be new, because we'll all pass from the scene, eventually, one way or another. So it's not as if newbie opinion is utterly irrelevant here.
Disagreeing with my expressed position on readability is fair. Writing as if I'd never expressed that position, however, is not.
-michael turner On Sat, May 21, 2011 at 12:04 AM, Edmond Begumisa <[hidden email]> wrote:
_______________________________________________ erlang-questions mailing list [hidden email] http://erlang.org/mailman/listinfo/erlang-questions |
|
As I described previously: I actually think that the current syntax is
*better for newbies* (especially those coming from imperative languages) since it drills-in Erlang's declarative nature. I view your proposal as something to cater for the experienced Erlanger who wants an alternative syntax for one-off scenarios. - Edmond - On Sat, 21 May 2011 01:19:43 +1000, Michael Turner <[hidden email]> wrote: > Anyone who thinks that I address the needs of writers in preference to > readers on this thread hasn't been reading me with much attention. > Readability is somewhat in the eye of the beholder. A lot of the > beholders > on this list are seasoned Erlang programmers. It's pretty clear what they > prefer: the way things are. > > I happen to find the indented style I propose more readable. I have also > said that I think programmers new to Erlang would tend to agree, although > without a scientific test it would be hard to establish this, I admit. > Some > day, if Erlang survives, all the eyes on it will be new, because we'll > all > pass from the scene, eventually, one way or another. So it's not as if > newbie opinion is utterly irrelevant here. > > Disagreeing with my expressed position on readability is fair. Writing > as if > I'd never expressed that position, however, is not. > > -michael turner > > On Sat, May 21, 2011 at 12:04 AM, Edmond Begumisa < > [hidden email]> wrote: > >> consider the needs of READERS in preference to WRITERS. >>> >> >> I found this statement nicely summed up the conflicting views on this >> thread. Very well put. And it puts the issue to rest IMO. >> >> - Edmond - >> >> >> >> On Fri, 20 May 2011 18:27:03 +1000, Richard O'Keefe <[hidden email]> >> wrote: >> >> >>> On 19/05/2011, at 4:08 AM, Michael Turner wrote: >>> >>> "Sorry, but Erlang doesn't *need* a better chance of survival." >>>> >>>> Now, wait, I'm really pretty sure that, less than a year ago, I saw >>>> both >>>> Peyton-Jones and Armstong in a video, speculating about the future of >>>> their >>>> respective favorite languages, and openly wondering what the long-term >>>> future held. >>>> >>> >>> And? Haskell is booming. They tried to avoid success and failed >>> miserably. >>> >>> In the meantime, I haven't noticed a dramatic increase in the >>> frequency >>>> of Erlang job postings, though perhaps it's gone up. However, a >>>> doubling >>>> would still leave the number small. >>>> >>> >>> That does not mean that Erlang is under threat. Come to think of it, >>> R is >>> booming >>> also. There are at least 81 mirrors of CRAN to handle the download >>> volumes. How >>> many R jobs do you see? >>> >>>> >>>> "Changing core language features that are solid,..." >>>> >>>> Except that that what I proposes fixes a weak spot (among other >>>> things): >>>> failed syntactic consistency. >>>> >>> >>> No, it leaves the *weak* spot (the absence of names in funs) along >>> and smashes the *strong* spot. >>> >>>> >>>> "... well thought out ..." >>>> >>>> Except that Joe Armstrong has just admitted (on this thread, IIRC) >>>> that >>>> the reason for the inconsistency is that they just didn't think about >>>> it at >>>> the time...." >>>> >>> >>> If you mean when "funs" were introduced, that may be so. >>> But the repeated function names were copied from languages where it >>> *WAS* >>> well thought out, rather like you probably would not fault someone for >>> designing a programming language using [] for array subscripting. >>> >>> >>>> "... and non-harmful ..." >>>> >>>> Implying that what I suggest here IS harmful? >>>> >>> >>> Yes, it is >>> It would seriously impair readability. >>> It would break several code processing tools that I use. >>> It would drastically impair the usefulness of every existing Erlang >>> book. >>> >>>> >>>> Actually not. No amount of education and experience will make >>>> repeating >>>> the function name with every clause a DRY issue, for those who find >>>> that >>>> repetition as more of an obstacle than otherwise. >>>> >>> >>> Remember always to consider the needs of READERS in preference to >>> WRITERS. >>> >>> Take Haskell, as an example. One of the advantages of Haskell is that >>> the >>> types of functions can be inferred from their bodies (as long as you >>> stick >>> to the standard language and don't use the rank 2 extension GHC >>> offers). >>> Why then do most Haskell programmers recommend writing down function >>> types >>> anyway, even though that violates DRY? >>> >>> Because although the type *is* implicit in the code, and the *compiler* >>> can figure it out, that doesn't mean it's easy for *humans*. >>> >>> If you are one of the people who find repeating function names an >>> obstacle >>> (on present evidence, a set of cardinality one), >>> - you don't have to use Erlang >>> - you can always write cases if you want >>> - you could look into LFE >>> - you could write your own preprocessor >>> >>> >>> No amount of education and experience will keep people from wondering, >>>> "Why this strange inconsistency?" >>>> >>> >>> As a matter of fact, I've known about Erlang since about a year (maybe >>> two) since the first paper >>> on it. Since well before it *had* funs, in fact. And you know, I've >>> *never* had that thought. >>> I don't experience any inconsistency. >>> >>> oAnd better documentation and training will only make more people ask >>>> that question. I didn't ask that question until I *stumbled* on the >>>> extended >>>> syntax for funs; I didn't know about it before. >>>> >>> >>> "Extended syntax for funs?" What's that? The syntax of funs is >>> described >>> in >>> chapter 7 of the reference manual, the chapter on expressions, which is >>> exactly >>> where you would expect to find it. >>> >>> The inconsistency I see is that functions are OK but funs >>> (a) do not permit a visible function name >>> -- just like Haskell, Clean, SML, CAML, &c >>> (b) begin with "fun" instead of just beginning >>> -- just like Haskell, Clean, SML, &c >>> (c) end with "end" instead of ending with a "." >>> -- the other languages I mentioned do not have any >>> -- terminator, so I usually find myself having to >>> -- wrap them in parentheses. It's quite nice not >>> -- having to do that. >>> >>> However, (b) and (c) are unsurprising because funs are >>> *expressions* and normal function definitions are not. >>> >>> If you are that upset about (a), I suggest that the inconsistency >>> should be resolved by allowing funs to have names, as I've suggested, >>> because that would fix the *other* difference between funs and >>> normal functions, which is that normal functions can be directly >>> recursive, and funs cannot. >>> >>> Your proposal to add a definition style that I find horrible for >>> normal functions fails to do anything about that *other* difference >>> between functions and funs. >>> >>> I repeat, you are urging that a *strong* spot be smashed to make >>> it consistent with a *weak* spot, which is quite the wrong way around. >>> >>> _______________________________________________ >>> erlang-questions mailing list >>> [hidden email] >>> http://erlang.org/mailman/listinfo/erlang-questions >>> >> >> >> -- >> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ >> -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ _______________________________________________ erlang-questions mailing list [hidden email] http://erlang.org/mailman/listinfo/erlang-questions |
|
In reply to this post by James Churchman
On Fri, May 20, 2011 at 12:44 AM, James Churchman <[hidden email]> wrote: winner for the most nit-pickey thread ever Unfortunately not.
/Joe
_______________________________________________ erlang-questions mailing list [hidden email] http://erlang.org/mailman/listinfo/erlang-questions |
|
In reply to this post by Steve Strong
On Fri, May 20, 2011 at 9:12 AM, Steve Strong <[hidden email]> wrote:
You cannot imagine number of meetings involved - the time to change the code base is tiny compared to the arguments with project mangers etc...
_______________________________________________ erlang-questions mailing list [hidden email] http://erlang.org/mailman/listinfo/erlang-questions |
|
In reply to this post by Michael Turner
On Fri, May 20, 2011 at 10:57:32PM +0900, Michael Turner wrote:
> "... looking at both backward *and* forward compatibility issues (what sort > of things might this change prevent us from doing in the future?)" > > I have repeatedly asked people here what this change would break, and in > particular how it might compromise backward compatibility. Nobody has > answered, so far. Since the change amounts to the compiler silently Like you ask, you get your answers. It must be as simple as this: You ask the programmers here if this change would break any old code. Most certainly it would not, as you claim. But nobody will answer "this change is safe for all old code" because firstly you did not ask that, and secondly everybody knows that the only way to know for _sure_ is to implement the change and then see if it breaks anything. And even then all you know is that you have not found any code it breaks. Yet. But allright, I'll say it! The change does not break any old code. Happy now? But I might be wrong since I have not tested the change... And that does not make the proposed change any better. > inserting a function name during parsing at points where some IDE > environments already already insert the name literally when you type ";", > it's pretty hard to see how there could be a backward compatibility issue. > > As for forward compatibility, we have it from Joe that syntax changes hardly > every happen anyway. So if change is very unlikely to happen, forward > compatiblity isn't much of an issue either, is it? > > As for how many meetings it would take Ericsson to establish that the risk > is low/zero, well, OK, got me: I've worked as a software engineer in a > couple of large companies, so I know that these things can take time. In > fact, I remember life at one networking company where any single engineering > change order to the production system required no fewer than 25 signatures. > So you may have a point there. (Although I thought part of the point of open > source was to circumvent that kind of bureaucratic tarpit. Guess I was > wrong.) You indirectly say you think we (Erlang/OTP) are a bureaucratic tarpit. For us one point of Open Source is to get bugfixes and beta testing. We do not have to accept all suggested changes. Change without thought can be bad for any project, Open Source or not. > > "Emacs for one would need work since it's syntax highlighting would now be > broken." > > It would only be broken for any code that took advantage of the change I > suggest. Which would start out at exactly zero percent of the Erlang code > out there. As the supposed "harm" grew, well, somebody would go and modify > whatever needed to be modified, to make syntax highlighting work as it does > in Emacs already for the analogous syntax in Clojure. You understate the impact. If our Emacs mode does not support all syntax of the language, it is really broken. Also, the Vim users will be upset until that is fixed. Add to this pretty printer, debugger, evaluator, ... All should work for the would be current syntax. Leaving that to be fixed later by the community is not an option. > > "If this is so important to you ...." > > It is not that important to me (at the moment.) However, like anybody else, > I hate having my case for change twisted by others, and I hate objections to > ideas (mine and others) when the objections don't actually hold water. I think that your claim that the change is small, simple and limited does not hold water, when looking at the whole system. > > If you think the thread is a waste of *your* time, you're free to not > contribute to it. > > -michael turner > > On Fri, May 20, 2011 at 4:12 PM, Steve Strong <[hidden email]> wrote: > > > Do you seriously think that a compiler team of a well-established and > > widely used language would implement a new syntax in less than a day? The > > code change itself may be relatively trivial (or a total pain in the arse, > > I've not looked at the current compiler code and could believe either), but > > whichever it is, it will be dwarfed by the design meetings held prior to > > making the change - looking at both backward *and* forward compatibility > > issues (what sort of things might this change prevent us from doing in the > > future?), plus the testing that would need to be performed after. > > > > And then there's all the tools that would be broken. Emacs for one would > > need work since it's syntax highlighting would now be broken. All this for > > a really minor change that, judging from the responses on this list, not > > that many people even want. > > > > Dude, this thread has gone on long enough and wasted way too much time. If > > this is so important to you, then do it yourself (after all, it's less than > > a days work) and publish the changes. > > > > Cheers, > > > > Steve > > > > -- > > Steve Strong, Director, id3as > > twitter.com/srstrong > > > > On Friday, 20 May 2011 at 07:29, Michael Turner wrote: > > > > Thank you, Frédéric, for taking a serious look at the idea. However, I see > > a few of the same unsubstantiated objections raised, with a couple more > > questionable ones added. > > > > "- It makes it less obvious that a function has many clauses (see Steve > > Davis' code)" > > > > WITH Steve's style of indentation. I suggested a more readable alternative, > > where the "(Args)->" part has indentation column to themselves. (Curiously, > > you employ my suggested indentation style yourself, below, in a supposedly > > "ambiguous" code sample.) > > > > "- it somewhat unifies the syntax with funs, but then funs still finish > > with 'end' and take no name." > > > > Perhaps syntax would become even more regular than you suggest. What I > > propose results in a grammar more like this: > > > > function: > > clause-list + "." > > fun: > > "fun" + clause-list + "end" > > clause: > > [optional name] (arg-list) guards -> stmt-list > > > > This is, if anything, more regular than the grammar is now. Yes, it > > *syntactically* allows for a *different* "optional name", but so does the > > current grammar; finding head mismatches *already* requires a separate step. > > And I question whether it requires the parser to produce a different AST > > than we get now, for parse-transform purposes. > > > > The above syntax also permits naming in funs. Is that so bad? As ROK has > > suggested, pehaps funs ought to be allowed (limited-scope) names to > > facilitate recursive definition. I happen to think it would work just as > > well to re-use the keyword "fun" to refer to the fun in the process of being > > defined. But there's something to be said for self-documenting recursive > > funs, so I could go either way on that one. Or both ways. (I hear the moans: > > "Not *another* way to do the same thing..." -- as if they were actually the > > same. And as if I weren't proposing here to do things ONE way.) > > > > "- it creates more learning overhead if both forms are used." > > > > That depends on how you learn (and teach) a language. Really: how much more > > page space does it require to show a slightly different way to do something? > > And then there are different learner styles. After learning the basics of a > > language, I tend to flip to an appendix like "syntax summary" (in BNF and > > other semi-formal styles), to start exploring the meaning of different > > combinatorial possibilities -- it's often one of the most clarifying and > > delightful exercises I undertake. Alas, neither of the Erlang books has any > > such an appendix (mandatory for a programming language primer, I would have > > thought.) For me, that has made learning Erlang harder. > > > > "- it's not faster (compile time, might even make compiling slower)" > > > > You've got to be kidding. It's long been known: the time complexity of > > parsing is overwhelmingly dominated by scanning. Code written in the form I > > propose would have fewer tokens to scan. > > > > "- it doesn't make the parser code easier to maintain" > > > > It might, actually. See above. > > > > "- it's making a lot of documentation obsolete that will need to be > > updated. This is common to all changes though." > > > > Yes, it is. Not to mention that the documentation on Erlang syntax is due > > for an upgrade anyway. The first hit I get on "Erlang" and "fun" yields the > > section "Syntax of funs", here: > > > > http://www.erlang.org/doc/programming_examples/funs.html#id59209 > > > > Yes, believe it: no coverage of the multi-clause case. > > > > "You'll be creating a hell of a lot more work ...." > > > > Ah, it seems almost obligatory on this thread: exaggeration asserted as > > fact. Would it really require even as much as a day's work on the parser? > > Yes, it would require updating documentation of Erlang syntax, but that > > documentation that (see above) clearly needs a little work anyway. > > > > "Oh and lastly, you could also have to consider this ambiguity ...." > > > > It wouldn't even be an ambiguity. It would only be a weird and pointless > > way to write that code. And that's IF someone wrote code like that. Well, > > anybody can write crappy and confusing code that abuses any language > > feature. (There it is: my own obligatory exaggeration for this thread.) Any > > "obfuscated Erlang contest" would likely to whack the worst Obfuscated C out > > the ballpark. (And that's no exaggeration.) > > > > -michael turner > > > > 2011/5/19 Frédéric Trottier-Hébert <[hidden email]> > > > > Well let's take a look here. Syntax doesn't have to break old code to > > change, that's a good point. > > > > You'll see that if you try {lists, sort}([3,2,1]), you will obtain [1,2,3]. > > This basic fun syntax dates from before Erlang actually had funs (fun > > M:F/A). You'll notice that it was less complex, tends to avoid verbosity and > > is somewhat more readable than doing (fun lists:sort/1)([1,2,3]). Going to > > the new syntax didn't break any code, didn't require old working code to be > > rewritten (things still work the old way, and parametrized modules are based > > on that bit of syntax) and people just ignore it if they don't need it. Yet > > people did the switch from {Mod, Fun} to fun M:F/A. > > > > Why? Because, I figure, people generally liked the new way better: it's > > faster (apparently much faster), much cleaner in intent and purposes, and > > way easier to figure out that we're actually dealing with a higher order > > function and not some weird concept. Plus you have to consider that in many > > places, you can just use 'Var(Args)' with either form. This switch had many > > wins over conciseness. > > > > If we try to do the same with your suggestion for the new Erlang syntax, we > > can basically see that it has a few advantages: > > > > - reduces typing required by avoiding name repetitions > > - it doesn't break existing code > > - it somewhat unifies the syntax with funs, but then funs still finish with > > 'end' and take no name. > > > > > > I, however, see the following disadvantages: > > > > - it creates multiple standards left to personal preference > > - it makes it less obvious that a function has many clauses (see Steve > > Davis' code) > > - it creates more learning overhead if both forms are used. {Mod,Fun} for > > funs has no overhead because it's basically deprecated and nobody uses it. > > - All the existing tools have to be updated to understand it -- at least > > those working on source files (and this includes editors and whatnot) > > > > To this, you must add a multiplier damage (heh) for things it doesn't make > > better: > > - it's not faster (compile time, might even make compiling slower) > > - it doesn't make the parser code easier to maintain > > - it doesn't make maintaining code in modules easier (except for some > > readability benefits) > > - it's not helping people understand the language better (based on my > > observations that people have no problems with the current form when it > > comes to understanding) > > - it's making a lot of documentation obsolete that will need to be updated. > > This is common to all changes though. > > > > In my opinion, typing less code, even if it doesn't break compatibility, is > > not worth the change. You'll be creating a hell of a lot more work if only > > to get a bit more concise and consistent syntax on a thing where people > > don't even agree you get better readability. > > > > > > Oh and lastly, you could also have to consider this ambiguity -- is the > > following bit of code acceptable? > > > > my_function > > (a,b,c) -> {a,b,c}; > > (a,c,b) -> {a,b,v}; > > my_function > > (c,b,a) -> {a,b,c}. > > > > > > On 2011-05-19, at 09:43 AM, Michael Turner wrote: > > > > > "Erlang is sufficiently mature that the syntax is now very difficult to > > change." > > > > > > Nobody has yet told me why this proposed change would break any existing > > code, or why it would require any significant work on the parser. > > > > > > -- > > Fred Hébert > > http://www.erlang-solutions.com > > > > > > _______________________________________________ > > erlang-questions mailing list > > [hidden email] > > http://erlang.org/mailman/listinfo/erlang-questions > > > > > > > _______________________________________________ > erlang-questions mailing list > [hidden email] > http://erlang.org/mailman/listinfo/erlang-questions -- / Raimo Niskanen, Erlang/OTP, Ericsson AB _______________________________________________ erlang-questions mailing list [hidden email] http://erlang.org/mailman/listinfo/erlang-questions |
|
In reply to this post by Michael Turner
On Fri, 20 May 2011 23:57:32 +1000, Michael Turner
<[hidden email]> wrote: > "... looking at both backward *and* forward compatibility issues (what > sort > of things might this change prevent us from doing in the future?)" > > I have repeatedly asked people here what this change would break, and in > particular how it might compromise backward compatibility. Nobody has > answered, so far. Since the change amounts to the compiler silently > inserting a function name during parsing at points where some IDE > environments already already insert the name literally when you type ";", > it's pretty hard to see how there could be a backward compatibility > issue. > > As for forward compatibility, we have it from Joe that syntax changes > hardly > every happen anyway. So if change is very unlikely to happen, forward > compatiblity isn't much of an issue either, is it? > > As for how many meetings it would take Ericsson to establish that the > risk > is low/zero, well, OK, got me: I've worked as a software engineer in a > couple of large companies, so I know that these things can take time. In > fact, I remember life at one networking company where any single > engineering > change order to the production system required no fewer than 25 > signatures. > So you may have a point there. (Although I thought part of the point of > open > source was to circumvent that kind of bureaucratic tarpit. Guess I was > wrong.) One of the main motivations for a private company to open-source their proprietary code is to have *others* improve it not just have others make *suggestions* for its improvement. Suggestions can be obtained even with closed source software. Erlang has the EEP system for this. As others have suggested, if you really feel strongly on this prove everyone wrong! Write up an EEP. Show everyone that their fears are exaggerated. Supply a patch so we can see for ourselves how cool it would be! It wouldn't be the first time a skeptical community has been eventually convinced. But there's a problem with this... > "Emacs for one would need work since it's syntax highlighting would now > be > broken." > > It would only be broken for any code that took advantage of the change I > suggest. Which would start out at exactly zero percent of the Erlang code > out there. As the supposed "harm" grew, well, somebody would go and > modify > whatever needed to be modified, to make syntax highlighting work as it > does > in Emacs already for the analogous syntax in Clojure. > > "If this is so important to you ...." > > It is not that important to me (at the moment.) ... it's not that important to you. You have better things to do correct? At the moment it's just a minor inconvenience, right? So why let it get to you? > However, like anybody else, > I hate having my case for change twisted by others, and I hate > objections to > ideas (mine and others) when the objections don't actually hold water. So let me understand this... The change is not _that_ important to you (not important enough to effect it yourself.) But you'll happily imply that others should effect the change (which is fair enough BTW -- others may be far more intimate with the code that would need changing.) But when those others (those both more intimate with the code and whom you are essentially asking to make the change), when _they_ tell you that they don't see the need for it, and give you _their_ reasons for not wanting to effect it -- you say hogwash! All on a change that's not that important to you! That position is a little unfair don't you think? - Edmond - > If you think the thread is a waste of *your* time, you're free to not > contribute to it. > > -michael turner > > On Fri, May 20, 2011 at 4:12 PM, Steve Strong <[hidden email]> wrote: > >> Do you seriously think that a compiler team of a well-established and >> widely used language would implement a new syntax in less than a day? >> The >> code change itself may be relatively trivial (or a total pain in the >> arse, >> I've not looked at the current compiler code and could believe either), >> but >> whichever it is, it will be dwarfed by the design meetings held prior to >> making the change - looking at both backward *and* forward compatibility >> issues (what sort of things might this change prevent us from doing in >> the >> future?), plus the testing that would need to be performed after. >> >> And then there's all the tools that would be broken. Emacs for one >> would >> need work since it's syntax highlighting would now be broken. All this >> for >> a really minor change that, judging from the responses on this list, not >> that many people even want. >> >> Dude, this thread has gone on long enough and wasted way too much >> time. If >> this is so important to you, then do it yourself (after all, it's less >> than >> a days work) and publish the changes. >> >> Cheers, >> >> Steve >> >> -- >> Steve Strong, Director, id3as >> twitter.com/srstrong >> >> On Friday, 20 May 2011 at 07:29, Michael Turner wrote: >> >> Thank you, Frédéric, for taking a serious look at the idea. However, I >> see >> a few of the same unsubstantiated objections raised, with a couple more >> questionable ones added. >> >> "- It makes it less obvious that a function has many clauses (see Steve >> Davis' code)" >> >> WITH Steve's style of indentation. I suggested a more readable >> alternative, >> where the "(Args)->" part has indentation column to themselves. >> (Curiously, >> you employ my suggested indentation style yourself, below, in a >> supposedly >> "ambiguous" code sample.) >> >> "- it somewhat unifies the syntax with funs, but then funs still finish >> with 'end' and take no name." >> >> Perhaps syntax would become even more regular than you suggest. What I >> propose results in a grammar more like this: >> >> function: >> clause-list + "." >> fun: >> "fun" + clause-list + "end" >> clause: >> [optional name] (arg-list) guards -> stmt-list >> >> This is, if anything, more regular than the grammar is now. Yes, it >> *syntactically* allows for a *different* "optional name", but so does >> the >> current grammar; finding head mismatches *already* requires a separate >> step. >> And I question whether it requires the parser to produce a different AST >> than we get now, for parse-transform purposes. >> >> The above syntax also permits naming in funs. Is that so bad? As ROK has >> suggested, pehaps funs ought to be allowed (limited-scope) names to >> facilitate recursive definition. I happen to think it would work just as >> well to re-use the keyword "fun" to refer to the fun in the process of >> being >> defined. But there's something to be said for self-documenting recursive >> funs, so I could go either way on that one. Or both ways. (I hear the >> moans: >> "Not *another* way to do the same thing..." -- as if they were actually >> the >> same. And as if I weren't proposing here to do things ONE way.) >> >> "- it creates more learning overhead if both forms are used." >> >> That depends on how you learn (and teach) a language. Really: how much >> more >> page space does it require to show a slightly different way to do >> something? >> And then there are different learner styles. After learning the basics >> of a >> language, I tend to flip to an appendix like "syntax summary" (in BNF >> and >> other semi-formal styles), to start exploring the meaning of different >> combinatorial possibilities -- it's often one of the most clarifying and >> delightful exercises I undertake. Alas, neither of the Erlang books has >> any >> such an appendix (mandatory for a programming language primer, I would >> have >> thought.) For me, that has made learning Erlang harder. >> >> "- it's not faster (compile time, might even make compiling slower)" >> >> You've got to be kidding. It's long been known: the time complexity of >> parsing is overwhelmingly dominated by scanning. Code written in the >> form I >> propose would have fewer tokens to scan. >> >> "- it doesn't make the parser code easier to maintain" >> >> It might, actually. See above. >> >> "- it's making a lot of documentation obsolete that will need to be >> updated. This is common to all changes though." >> >> Yes, it is. Not to mention that the documentation on Erlang syntax is >> due >> for an upgrade anyway. The first hit I get on "Erlang" and "fun" yields >> the >> section "Syntax of funs", here: >> >> http://www.erlang.org/doc/programming_examples/funs.html#id59209 >> >> Yes, believe it: no coverage of the multi-clause case. >> >> "You'll be creating a hell of a lot more work ...." >> >> Ah, it seems almost obligatory on this thread: exaggeration asserted as >> fact. Would it really require even as much as a day's work on the >> parser? >> Yes, it would require updating documentation of Erlang syntax, but that >> documentation that (see above) clearly needs a little work anyway. >> >> "Oh and lastly, you could also have to consider this ambiguity ...." >> >> It wouldn't even be an ambiguity. It would only be a weird and pointless >> way to write that code. And that's IF someone wrote code like that. >> Well, >> anybody can write crappy and confusing code that abuses any language >> feature. (There it is: my own obligatory exaggeration for this thread.) >> Any >> "obfuscated Erlang contest" would likely to whack the worst Obfuscated >> C out >> the ballpark. (And that's no exaggeration.) >> >> -michael turner >> >> 2011/5/19 Frédéric Trottier-Hébert <[hidden email]> >> >> Well let's take a look here. Syntax doesn't have to break old code to >> change, that's a good point. >> >> You'll see that if you try {lists, sort}([3,2,1]), you will obtain >> [1,2,3]. >> This basic fun syntax dates from before Erlang actually had funs (fun >> M:F/A). You'll notice that it was less complex, tends to avoid >> verbosity and >> is somewhat more readable than doing (fun lists:sort/1)([1,2,3]). Going >> to >> the new syntax didn't break any code, didn't require old working code >> to be >> rewritten (things still work the old way, and parametrized modules are >> based >> on that bit of syntax) and people just ignore it if they don't need >> it. Yet >> people did the switch from {Mod, Fun} to fun M:F/A. >> >> Why? Because, I figure, people generally liked the new way better: it's >> faster (apparently much faster), much cleaner in intent and purposes, >> and >> way easier to figure out that we're actually dealing with a higher order >> function and not some weird concept. Plus you have to consider that in >> many >> places, you can just use 'Var(Args)' with either form. This switch had >> many >> wins over conciseness. >> >> If we try to do the same with your suggestion for the new Erlang >> syntax, we >> can basically see that it has a few advantages: >> >> - reduces typing required by avoiding name repetitions >> - it doesn't break existing code >> - it somewhat unifies the syntax with funs, but then funs still finish >> with >> 'end' and take no name. >> >> >> I, however, see the following disadvantages: >> >> - it creates multiple standards left to personal preference >> - it makes it less obvious that a function has many clauses (see Steve >> Davis' code) >> - it creates more learning overhead if both forms are used. {Mod,Fun} >> for >> funs has no overhead because it's basically deprecated and nobody uses >> it. >> - All the existing tools have to be updated to understand it -- at least >> those working on source files (and this includes editors and whatnot) >> >> To this, you must add a multiplier damage (heh) for things it doesn't >> make >> better: >> - it's not faster (compile time, might even make compiling slower) >> - it doesn't make the parser code easier to maintain >> - it doesn't make maintaining code in modules easier (except for some >> readability benefits) >> - it's not helping people understand the language better (based on my >> observations that people have no problems with the current form when it >> comes to understanding) >> - it's making a lot of documentation obsolete that will need to be >> updated. >> This is common to all changes though. >> >> In my opinion, typing less code, even if it doesn't break >> compatibility, is >> not worth the change. You'll be creating a hell of a lot more work if >> only >> to get a bit more concise and consistent syntax on a thing where people >> don't even agree you get better readability. >> >> >> Oh and lastly, you could also have to consider this ambiguity -- is the >> following bit of code acceptable? >> >> my_function >> (a,b,c) -> {a,b,c}; >> (a,c,b) -> {a,b,v}; >> my_function >> (c,b,a) -> {a,b,c}. >> >> >> On 2011-05-19, at 09:43 AM, Michael Turner wrote: >> >> > "Erlang is sufficiently mature that the syntax is now very difficult >> to >> change." >> > >> > Nobody has yet told me why this proposed change would break any >> existing >> code, or why it would require any significant work on the parser. >> >> >> -- >> Fred Hébert >> http://www.erlang-solutions.com >> >> >> _______________________________________________ >> erlang-questions mailing list >> [hidden email] >> http://erlang.org/mailman/listinfo/erlang-questions >> >> >> -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ _______________________________________________ erlang-questions mailing list [hidden email] http://erlang.org/mailman/listinfo/erlang-questions |
|
"But you'll happily imply that others should effect the change "
Oh, no, I have given up on that. I can now see why it's not going to happen.
"... when _they_ tell you that they don't see the need for it, and give you _their_ reasons for not wanting to effect it -- you say hogwash! All on a change that's not that important to you!"
For some strange reason, it IS important to me when people misrepresent my positions. As you just did. From the very first post I made on this thread, I talked about readability. You responded as if I had prioritized writeability over readability. Is that fair? Have you even *read* the first post I made on this? (Which pretty much laid out my entire case.) Or do you consider that a dispensable step in coming to a judgment of my position?
Here's the core paragraph from that first post: "It's also less to type and to read, which is consistent with the DRY principle ("Don't Repeat Yourself"). And it lends itself to reading a function definition as a set of cases. I think for Erlang newbies, it should therefore would be preferred: it helps underscore the pattern-matching style of Erlang function invocation."
That's an argument in which readability weighs slightly more, isn't it?
-michael turner
On Sat, May 21, 2011 at 2:16 AM, Edmond Begumisa <[hidden email]> wrote: On Fri, 20 May 2011 23:57:32 +1000, Michael Turner <[hidden email]> wrote: _______________________________________________ erlang-questions mailing list [hidden email] http://erlang.org/mailman/listinfo/erlang-questions |
|
In reply to this post by Raimo Niskanen-2
"You indirectly say you think we (Erlang/OTP) are a bureaucratic tarpit."
It's more like Joe's comment made me think that Erlang/OTP has to live in such a tarpit. I've lived in those as a programmer, it was hellish, so I can sympathize, if in fact that's anything like your situation. But it seems I misinterpreted him. With that, I give up. Oh wait, also this: I really apologize if any of you chose to waste time on this thread. I'm sorry for making you do that. It's really all my fault. -michael turner
On Sat, May 21, 2011 at 12:46 AM, Raimo Niskanen <[hidden email]> wrote: On Fri, May 20, 2011 at 10:57:32PM +0900, Michael Turner wrote: _______________________________________________ erlang-questions mailing list [hidden email] http://erlang.org/mailman/listinfo/erlang-questions |
|
In reply to this post by Michael Turner
Not only did I read your original post I even quoted it. Explaining
exactly why _I_ thought it was less readable for Erlang new-comers, hence the only advantage left being writeability. Or do *you* pick and chose what you read? - Edmond - On Sat, 21 May 2011 03:51:22 +1000, Michael Turner <[hidden email]> wrote: > "But you'll happily imply that others should effect the change " > > Oh, no, I have given up on that. I can now see why it's not going to > happen. > > "... when _they_ tell you that they don't see the need for it, and give > you > _their_ reasons for not wanting to effect it -- you say hogwash! All on a > change that's not that important to you!" > > For some strange reason, it IS important to me when people misrepresent > my > positions. As you just did. > > From the very first post I made on this thread, I talked about > readability. > You responded as if I had prioritized writeability over readability. Is > that > fair? Have you even *read* the first post I made on this? (Which pretty > much > laid out my entire case.)Or do you consider that a dispensable step in > coming to a judgment of my position? > > Here's the core paragraph from that first post: > > "It's also less to type and to read, which is consistent with the DRY > principle ("Don't Repeat Yourself"). And it lends itself to reading a > function definition as a set of cases. I think for Erlang newbies, it > should > therefore would be preferred: it helps underscore the pattern-matching > style > of Erlang function invocation." > > That's an argument in which readability weighs slightly more, isn't it? > > -michael turner > > > On Sat, May 21, 2011 at 2:16 AM, Edmond Begumisa < > [hidden email]> wrote: > >> On Fri, 20 May 2011 23:57:32 +1000, Michael Turner < >> [hidden email]> wrote: >> >> "... looking at both backward *and* forward compatibility issues (what >>> sort >>> >>> of things might this change prevent us from doing in the future?)" >>> >>> I have repeatedly asked people here what this change would break, and >>> in >>> particular how it might compromise backward compatibility. Nobody has >>> answered, so far. Since the change amounts to the compiler silently >>> inserting a function name during parsing at points where some IDE >>> environments already already insert the name literally when you type >>> ";", >>> it's pretty hard to see how there could be a backward compatibility >>> issue. >>> >>> As for forward compatibility, we have it from Joe that syntax changes >>> hardly >>> every happen anyway. So if change is very unlikely to happen, forward >>> compatiblity isn't much of an issue either, is it? >>> >>> As for how many meetings it would take Ericsson to establish that the >>> risk >>> is low/zero, well, OK, got me: I've worked as a software engineer in a >>> couple of large companies, so I know that these things can take time. >>> In >>> fact, I remember life at one networking company where any single >>> engineering >>> change order to the production system required no fewer than 25 >>> signatures. >>> So you may have a point there. (Although I thought part of the point of >>> open >>> source was to circumvent that kind of bureaucratic tarpit. Guess I was >>> wrong.) >>> >> >> One of the main motivations for a private company to open-source their >> proprietary code is to have *others* improve it not just have others >> make >> *suggestions* for its improvement. Suggestions can be obtained even with >> closed source software. >> >> Erlang has the EEP system for this. As others have suggested, if you >> really >> feel strongly on this prove everyone wrong! Write up an EEP. Show >> everyone >> that their fears are exaggerated. Supply a patch so we can see for >> ourselves >> how cool it would be! It wouldn't be the first time a skeptical >> community >> has been eventually convinced. >> >> But there's a problem with this... >> >> >> "Emacs for one would need work since it's syntax highlighting would >> now be >>> broken." >>> >>> It would only be broken for any code that took advantage of the change >>> I >>> suggest. Which would start out at exactly zero percent of the Erlang >>> code >>> out there. As the supposed "harm" grew, well, somebody would go and >>> modify >>> whatever needed to be modified, to make syntax highlighting work as it >>> does >>> in Emacs already for the analogous syntax in Clojure. >>> >>> "If this is so important to you ...." >>> >>> It is not that important to me (at the moment.) >>> >> >> ... it's not that important to you. You have better things to do >> correct? >> At the moment it's just a minor inconvenience, right? So why let it get >> to >> you? >> >> >> However, like anybody else, >>> I hate having my case for change twisted by others, and I hate >>> objections >>> to >>> ideas (mine and others) when the objections don't actually hold water. >>> >> >> So let me understand this... >> >> The change is not _that_ important to you (not important enough to >> effect >> it yourself.) But you'll happily imply that others should effect the >> change >> (which is fair enough BTW -- others may be far more intimate with the >> code >> that would need changing.) But when those others (those both more >> intimate >> with the code and whom you are essentially asking to make the change), >> when >> _they_ tell you that they don't see the need for it, and give you >> _their_ >> reasons for not wanting to effect it -- you say hogwash! All on a change >> that's not that important to you! >> >> That position is a little unfair don't you think? >> >> - Edmond - >> >> >> >> >> If you think the thread is a waste of *your* time, you're free to not >>> contribute to it. >>> >>> -michael turner >>> >>> On Fri, May 20, 2011 at 4:12 PM, Steve Strong <[hidden email]> >>> wrote: >>> >>> Do you seriously think that a compiler team of a well-established and >>>> widely used language would implement a new syntax in less than a day? >>>> The >>>> code change itself may be relatively trivial (or a total pain in the >>>> arse, >>>> I've not looked at the current compiler code and could believe >>>> either), >>>> but >>>> whichever it is, it will be dwarfed by the design meetings held prior >>>> to >>>> making the change - looking at both backward *and* forward >>>> compatibility >>>> issues (what sort of things might this change prevent us from doing in >>>> the >>>> future?), plus the testing that would need to be performed after. >>>> >>>> And then there's all the tools that would be broken. Emacs for one >>>> would >>>> need work since it's syntax highlighting would now be broken. All >>>> this >>>> for >>>> a really minor change that, judging from the responses on this list, >>>> not >>>> that many people even want. >>>> >>>> Dude, this thread has gone on long enough and wasted way too much >>>> time. >>>> If >>>> this is so important to you, then do it yourself (after all, it's less >>>> than >>>> a days work) and publish the changes. >>>> >>>> Cheers, >>>> >>>> Steve >>>> >>>> -- >>>> Steve Strong, Director, id3as >>>> twitter.com/srstrong >>>> >>>> On Friday, 20 May 2011 at 07:29, Michael Turner wrote: >>>> >>>> Thank you, Frédéric, for taking a serious look at the idea. However, I >>>> see >>>> a few of the same unsubstantiated objections raised, with a couple >>>> more >>>> questionable ones added. >>>> >>>> "- It makes it less obvious that a function has many clauses (see >>>> Steve >>>> Davis' code)" >>>> >>>> WITH Steve's style of indentation. I suggested a more readable >>>> alternative, >>>> where the "(Args)->" part has indentation column to themselves. >>>> (Curiously, >>>> you employ my suggested indentation style yourself, below, in a >>>> supposedly >>>> "ambiguous" code sample.) >>>> >>>> "- it somewhat unifies the syntax with funs, but then funs still >>>> finish >>>> with 'end' and take no name." >>>> >>>> Perhaps syntax would become even more regular than you suggest. What I >>>> propose results in a grammar more like this: >>>> >>>> function: >>>> clause-list + "." >>>> fun: >>>> "fun" + clause-list + "end" >>>> clause: >>>> [optional name] (arg-list) guards -> stmt-list >>>> >>>> This is, if anything, more regular than the grammar is now. Yes, it >>>> *syntactically* allows for a *different* "optional name", but so does >>>> the >>>> current grammar; finding head mismatches *already* requires a separate >>>> step. >>>> And I question whether it requires the parser to produce a different >>>> AST >>>> than we get now, for parse-transform purposes. >>>> >>>> The above syntax also permits naming in funs. Is that so bad? As ROK >>>> has >>>> suggested, pehaps funs ought to be allowed (limited-scope) names to >>>> facilitate recursive definition. I happen to think it would work just >>>> as >>>> well to re-use the keyword "fun" to refer to the fun in the process of >>>> being >>>> defined. But there's something to be said for self-documenting >>>> recursive >>>> funs, so I could go either way on that one. Or both ways. (I hear the >>>> moans: >>>> "Not *another* way to do the same thing..." -- as if they were >>>> actually >>>> the >>>> same. And as if I weren't proposing here to do things ONE way.) >>>> >>>> "- it creates more learning overhead if both forms are used." >>>> >>>> That depends on how you learn (and teach) a language. Really: how much >>>> more >>>> page space does it require to show a slightly different way to do >>>> something? >>>> And then there are different learner styles. After learning the >>>> basics of >>>> a >>>> language, I tend to flip to an appendix like "syntax summary" (in BNF >>>> and >>>> other semi-formal styles), to start exploring the meaning of different >>>> combinatorial possibilities -- it's often one of the most clarifying >>>> and >>>> delightful exercises I undertake. Alas, neither of the Erlang books >>>> has >>>> any >>>> such an appendix (mandatory for a programming language primer, I would >>>> have >>>> thought.) For me, that has made learning Erlang harder. >>>> >>>> "- it's not faster (compile time, might even make compiling slower)" >>>> >>>> You've got to be kidding. It's long been known: the time complexity of >>>> parsing is overwhelmingly dominated by scanning. Code written in the >>>> form >>>> I >>>> propose would have fewer tokens to scan. >>>> >>>> "- it doesn't make the parser code easier to maintain" >>>> >>>> It might, actually. See above. >>>> >>>> "- it's making a lot of documentation obsolete that will need to be >>>> updated. This is common to all changes though." >>>> >>>> Yes, it is. Not to mention that the documentation on Erlang syntax is >>>> due >>>> for an upgrade anyway. The first hit I get on "Erlang" and "fun" >>>> yields >>>> the >>>> section "Syntax of funs", here: >>>> >>>> http://www.erlang.org/doc/programming_examples/funs.html#id59209 >>>> >>>> Yes, believe it: no coverage of the multi-clause case. >>>> >>>> "You'll be creating a hell of a lot more work ...." >>>> >>>> Ah, it seems almost obligatory on this thread: exaggeration asserted >>>> as >>>> fact. Would it really require even as much as a day's work on the >>>> parser? >>>> Yes, it would require updating documentation of Erlang syntax, but >>>> that >>>> documentation that (see above) clearly needs a little work anyway. >>>> >>>> "Oh and lastly, you could also have to consider this ambiguity ...." >>>> >>>> It wouldn't even be an ambiguity. It would only be a weird and >>>> pointless >>>> way to write that code. And that's IF someone wrote code like that. >>>> Well, >>>> anybody can write crappy and confusing code that abuses any language >>>> feature. (There it is: my own obligatory exaggeration for this >>>> thread.) >>>> Any >>>> "obfuscated Erlang contest" would likely to whack the worst >>>> Obfuscated C >>>> out >>>> the ballpark. (And that's no exaggeration.) >>>> >>>> -michael turner >>>> >>>> 2011/5/19 Frédéric Trottier-Hébert <[hidden email]> >>>> >>>> Well let's take a look here. Syntax doesn't have to break old code to >>>> change, that's a good point. >>>> >>>> You'll see that if you try {lists, sort}([3,2,1]), you will obtain >>>> [1,2,3]. >>>> This basic fun syntax dates from before Erlang actually had funs (fun >>>> M:F/A). You'll notice that it was less complex, tends to avoid >>>> verbosity >>>> and >>>> is somewhat more readable than doing (fun lists:sort/1)([1,2,3]). >>>> Going >>>> to >>>> the new syntax didn't break any code, didn't require old working code >>>> to >>>> be >>>> rewritten (things still work the old way, and parametrized modules are >>>> based >>>> on that bit of syntax) and people just ignore it if they don't need >>>> it. >>>> Yet >>>> people did the switch from {Mod, Fun} to fun M:F/A. >>>> >>>> Why? Because, I figure, people generally liked the new way better: >>>> it's >>>> faster (apparently much faster), much cleaner in intent and purposes, >>>> and >>>> way easier to figure out that we're actually dealing with a higher >>>> order >>>> function and not some weird concept. Plus you have to consider that in >>>> many >>>> places, you can just use 'Var(Args)' with either form. This switch had >>>> many >>>> wins over conciseness. >>>> >>>> If we try to do the same with your suggestion for the new Erlang >>>> syntax, >>>> we >>>> can basically see that it has a few advantages: >>>> >>>> - reduces typing required by avoiding name repetitions >>>> - it doesn't break existing code >>>> - it somewhat unifies the syntax with funs, but then funs still finish >>>> with >>>> 'end' and take no name. >>>> >>>> >>>> I, however, see the following disadvantages: >>>> >>>> - it creates multiple standards left to personal preference >>>> - it makes it less obvious that a function has many clauses (see Steve >>>> Davis' code) >>>> - it creates more learning overhead if both forms are used. {Mod,Fun} >>>> for >>>> funs has no overhead because it's basically deprecated and nobody uses >>>> it. >>>> - All the existing tools have to be updated to understand it -- at >>>> least >>>> those working on source files (and this includes editors and whatnot) >>>> >>>> To this, you must add a multiplier damage (heh) for things it doesn't >>>> make >>>> better: >>>> - it's not faster (compile time, might even make compiling slower) >>>> - it doesn't make the parser code easier to maintain >>>> - it doesn't make maintaining code in modules easier (except for some >>>> readability benefits) >>>> - it's not helping people understand the language better (based on my >>>> observations that people have no problems with the current form when >>>> it >>>> comes to understanding) >>>> - it's making a lot of documentation obsolete that will need to be >>>> updated. >>>> This is common to all changes though. >>>> >>>> In my opinion, typing less code, even if it doesn't break >>>> compatibility, >>>> is >>>> not worth the change. You'll be creating a hell of a lot more work if >>>> only >>>> to get a bit more concise and consistent syntax on a thing where >>>> people >>>> don't even agree you get better readability. >>>> >>>> >>>> Oh and lastly, you could also have to consider this ambiguity -- is >>>> the >>>> following bit of code acceptable? >>>> >>>> my_function >>>> (a,b,c) -> {a,b,c}; >>>> (a,c,b) -> {a,b,v}; >>>> my_function >>>> (c,b,a) -> {a,b,c}. >>>> >>>> >>>> On 2011-05-19, at 09:43 AM, Michael Turner wrote: >>>> >>>> > "Erlang is sufficiently mature that the syntax is now very >>>> difficult to >>>> change." >>>> > >>>> > Nobody has yet told me why this proposed change would break any >>>> existing >>>> code, or why it would require any significant work on the parser. >>>> >>>> >>>> -- >>>> Fred Hébert >>>> http://www.erlang-solutions.com >>>> >>>> >>>> _______________________________________________ >>>> erlang-questions mailing list >>>> [hidden email] >>>> http://erlang.org/mailman/listinfo/erlang-questions >>>> >>>> >>>> >>>> >> >> -- >> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ >> -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ _______________________________________________ erlang-questions mailing list [hidden email] http://erlang.org/mailman/listinfo/erlang-questions |
|
In reply to this post by Michael Turner
On 21/05/2011, at 1:57 AM, Michael Turner wrote: > "... looking at both backward *and* forward compatibility issues (what sort of things might this change prevent us from doing in the future?)" > > I have repeatedly asked people here what this change would break, and in particular how it might compromise backward compatibility. Nobody has answered, so far. That's principally because people find the proposed change so disgusting that they don't greatly _care_ whether it is compatible or not; it's not compatible with *them*. > Since the change amounts to the compiler silently inserting a function name during parsing at points where some IDE environments already already insert the name literally when you type ";", it's pretty hard to see how there could be a backward compatibility issue. If you mean "could there be existing code whose meaning would be altered by this proposal", the answer is "no". If you mean "could existing tools, including third-party tools, handle this", the answer is "no, definitely not". > > "Emacs for one would need work since it's syntax highlighting would now be broken." > > It would only be broken for any code that took advantage of the change I suggest. The thing is that the number of people who took advantage of it is unknown and and the amount of code that would be affected is unknown and how fast the change would be adopted is unknown, so somebody using a well trusted tool would NEVER KNOW WHETHER IT WAS GOING TO BREAK on some file maintained by someone else. When the new syntax is in support of some new *semantics* that we have a need for, such as the introduction of 'fun's in the first place, then that is a price that can be worth paying. When the new syntax is merely syntactic strychnine, no. > Which would start out at exactly zero percent of the Erlang code out there. As the supposed "harm" grew, well, somebody would go and modify whatever needed to be modified, to make syntax highlighting work as it does in Emacs already for the analogous syntax in Clojure. > > "If this is so important to you ...." > > It is not that important to me (at the moment.) Then why are you wasting our time arguing for it? I've written a working parser for someone else's language in less of my time than you've wasted. If you care about it, implement it yourself or pay someone else to. > However, like anybody else, I hate having my case for change twisted by others, and I hate objections to ideas (mine and others) when the objections don't actually hold water. I haven't noticed anyone twisting your idea or your case for. You case is simply that it removes an "inconsistency" which nobody else seems to perceive as an inconsistency (or if they do, as one that needs fixing at the *other* end) and reduces an already trivial amount of typing and makes the language look more like other languages that many Erlang programmers have gladly abandoned. _______________________________________________ erlang-questions mailing list [hidden email] http://erlang.org/mailman/listinfo/erlang-questions |
|
In reply to this post by Richard O'Keefe
On 21/05/2011, at 2:11 AM, Michael Turner wrote: > "It seems to me that Michael Turner's argument is an argument from conservatism. > Algol, Basic, COBOL, Fortran, PL/I, Simula, XPL, Java, Javascript, PHP, Perl, > all of these languages write a function name once and only once at the beginning > of a function." > > But which of those allow more than one argument list? It's not quite clear to me what you mean here, but add(x)to:(y)giving:(z)and:(w) is perfectly good Algol 60. Javascript allows things like f(1)(2). And of course, anyone who knows Fortran knows that a Fortran subprogram may have multiple entry points, and so multiple formal parameter lists. If you mean "allow more than one CLAUSE", then the answer is that the languages that allow more than one clause in a named function repeat the name, just like Erlang. > I think the indentation style I suggest also makes it more immediately obvious that Erlang features a kind of pattern-directed invocation. People who are entirely new to Erlang are also entirely new to the idea of pattern directed invocation, and if they aren't, they are also not new to the idea of repeating the function name. If you are new to pattern directed invocation, your indentation is not going to help one iota: one left parenthesis or square bracket looks much like another. I will go this far: the discrepancy between functions and funs *is* a problem. But it is the *funs* that are the problem, and the remedy is to let them have names also. Allowing names in funs is not a case of syntactic strychnine; not even a case of syntactic sugar. It actually provides new and desired semantics (directly recursive funs), so it is at least _possible_ that it might repay the cost of adopting it. As things stand, I must say that I find multiclause funs in the usual indentation style (that is, in the indentation style you are recommending for normal functions) quite unreadable. > > As for what you claim is more readable, remember: the intuitive is the familiar. Someone who is entirely new to Erlang will perceive things differently. The people who actually *teach* Erlang to people who have not met us before tell us that they actually pick it up fairly easily. > The only way to make the proposition "syntax X is more readable" a scientific one is to test -- on people *new* to Erlang. Wrong. What a tricky way to load the case in your favour! The people who are entirely new to the language are the very LAST people you should study; then you are measuring LEARNABILITY (or more FAMILIARITY), not READABILITY. The kind of readability that matters is readability to people who have *some* experience with the language. People who have at least troubled to read an Erlang book all the way through, and can be bothered to read the Erlang reference manual once all the way through. By the time you get that far, you are not "entirely new" any more. I can tell you this: I went from knowing practically all the classic 60s and 70s programming languages (including ones you've probably never heard of), including Lisp, to learning Prolog. And one thing that never EVER gave me the slightest trouble whatsoever was having the name of a predicate repeated in each clause. _______________________________________________ erlang-questions mailing list [hidden email] http://erlang.org/mailman/listinfo/erlang-questions |
|
In reply to this post by Michael Turner
On 21/05/2011, at 2:13 AM, Michael Turner wrote: > "And why do you think I don't use Clojure?" > > Uh, Richard, where did he say he thought that? He didn't, and I don't know why you think I think he thought that. I was simply making the point that precisely because "this is name-less clause syntax is the same as in Clojure" it would be just as much a horrible mistake in Erlang as it is in Clojure. > _______________________________________________ erlang-questions mailing list [hidden email] http://erlang.org/mailman/listinfo/erlang-questions |
|
In reply to this post by Michael Turner
On 21/05/2011, at 2:30 AM, Michael Turner wrote: > "... because THAT IS COVERED IN THE REFERENCE MANUAL WHERE THE VERY > FIRST THING AFTER THE SECTION HEADING SHOWS A MULTICLAUSE FUN." > > And (he says, ears ringing slightly) that somehow makes it OK for any other part of the documentation to be wrong, I did not say that. I did not say anything from which any reasonable person could infer that. For one thing, I do not accept that the other part of the documentation is WRONG, only that it is INCOMPLETE. And yes, provided the reference manual is complete, it IS ok for other documentation to be incomplete. > even when your average learner is far more likely to encounter the erroneous passage first? Only a very dumb and irresponsible learner would fail to check the reference manual. Yes, you read the tutorials, you try the examples. But when you want to know the details of something, you read the reference manual. IF you are competent at programming language learning. > Thanks for the update about the proportions of time spent scanning vs. parsing. I'm under the influence of something I heard Bill Joy (then a student of Sue Graham's) say about lex and yacc back around 1980 or so. In any case, can we at least agree that the change I suggest is going to have minimal impact on parsing times? Sure. I don't actually _care_ about parsing times. I care about the pain *I* would suffer if I had to read stuff written that way. > > "If both the existing readable alternative and the proposed horrible one are supported, the code *has* to increase in volume, and *has* to become less maintainable." > > Even if it actually reduces the number of grammar rules, There is no reason to believe that it would do anything of the kind. > or keeps the number the same, There is no reason to believe that it would do anything of the kind. > and even if it means the same amount of head-match checking we have now? I don't know what you mean here. I am not discussing run-time complexity but the source code. > > "You are attacking one of the features of Erlang that I have found most helpful." > > I found this "feature" helpful in a way myself: from doing some Prolog programming, I had some experience with writing code in this pattern. But when I was doing Prolog programming, I had the same complaint about Prolog: dreary repetition of redundant identifiers where whitespace and indentation would (I thought) enhance readability. It took some getting used to. But I suppose I could have learned to love it if I'd done more Prolog programming. > > We have an eye of the beholder problem, here, obviously. Compared with something like Haskell, Prolog can indeed be "drearily repetitive". But the predicate names are NOT the dreary or noticeably repetitive part. For what it's worth, the identifiers are *NOT* redundant in Prolog. (Amongst other things, have you forgotten the existence of assertz/1? Or the :- discontiguous declaration?) _______________________________________________ erlang-questions mailing list [hidden email] http://erlang.org/mailman/listinfo/erlang-questions |
| Powered by Nabble | Edit this page |
