Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(735)

Issue 13256053: Stop \lyricmode { \skip 1.*3 } from failing. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 7 months ago by dak
Modified:
10 years, 6 months ago
Reviewers:
janek, Vik Reykja
CC:
lilypond-devel_gnu.org
Visibility:
Public.

Description

Stop \lyricmode { \skip 1.*3 } from failing. The problem was that the lexer preferred to match ".*" as a word since the matched pattern was longer than the explicit pattern matching ".". The word pattern is now amended so that it does not compete with the single-character patterns.

Patch Set 1 #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+1 line, -1 line) Patch
M lily/lexer.ll View 1 chunk +1 line, -1 line 3 comments Download

Messages

Total messages: 11
Vik Reykja
I think a patch like this requires at least one regression test.
10 years, 7 months ago (2013-09-22 22:30:51 UTC) #1
dak
On 2013/09/22 22:30:51, Vik Reykja wrote: > I think a patch like this requires at ...
10 years, 7 months ago (2013-09-23 06:50:56 UTC) #2
Vik Reykja
On Mon, Sep 23, 2013 at 8:50 AM, <dak@gnu.org> wrote: > On 2013/09/22 22:30:51, Vik ...
10 years, 7 months ago (2013-09-23 16:16:45 UTC) #3
dak
Vik Reykja <vikreykja@gmail.com> writes: > On Mon, Sep 23, 2013 at 8:50 AM, <dak@gnu.org> wrote: ...
10 years, 7 months ago (2013-09-23 16:59:09 UTC) #4
janek
https://codereview.appspot.com/13256053/diff/1/lily/lexer.ll File lily/lexer.ll (right): https://codereview.appspot.com/13256053/diff/1/lily/lexer.ll#newcode588 lily/lexer.ll:588: [^|*.=$#{}\"\\ \t\n\r\f0-9][^$#{}\"\\ \t\n\r\f0-9]* { Hmm. From my point of ...
10 years, 7 months ago (2013-09-24 07:44:44 UTC) #5
dak
https://codereview.appspot.com/13256053/diff/1/lily/lexer.ll File lily/lexer.ll (right): https://codereview.appspot.com/13256053/diff/1/lily/lexer.ll#newcode588 lily/lexer.ll:588: [^|*.=$#{}\"\\ \t\n\r\f0-9][^$#{}\"\\ \t\n\r\f0-9]* { On 2013/09/24 07:44:44, janek wrote: ...
10 years, 7 months ago (2013-09-24 16:15:39 UTC) #6
janek
https://codereview.appspot.com/13256053/diff/1/lily/lexer.ll File lily/lexer.ll (right): https://codereview.appspot.com/13256053/diff/1/lily/lexer.ll#newcode588 lily/lexer.ll:588: [^|*.=$#{}\"\\ \t\n\r\f0-9][^$#{}\"\\ \t\n\r\f0-9]* { On 2013/09/24 16:15:39, dak wrote: ...
10 years, 7 months ago (2013-09-24 22:29:56 UTC) #7
dak
On 2013/09/24 22:29:56, janek wrote: > https://codereview.appspot.com/13256053/diff/1/lily/lexer.ll > File lily/lexer.ll (right): > > https://codereview.appspot.com/13256053/diff/1/lily/lexer.ll#newcode588 > ...
10 years, 7 months ago (2013-09-24 23:16:31 UTC) #8
janek
2013/9/25 <dak@gnu.org>: > >> > On 2013/09/24 07:44:44, janek wrote: >> >> Hmm. From my ...
10 years, 6 months ago (2013-09-26 10:51:34 UTC) #9
dak
On 2013/09/26 10:51:34, janek wrote: > > > It does not belong in the code. ...
10 years, 6 months ago (2013-09-26 12:12:12 UTC) #10
janek
10 years, 6 months ago (2013-09-26 12:55:50 UTC) #11
2013/9/26  <dak@gnu.org>:
> On 2013/09/26 10:51:34, janek wrote:
>> Uh, David, thanks for this explanation, but i'm afraid it was not
>> needed.  If the code doesn't need a comment, just say so.
>>
>> Now, speaking in general: i don't understand that when Mike submits a
>> patch, you often complain that it's not commented well enough, but
>> when I ask you for comments, you usually say "this doesn't need any
>> comment".
>>
>> Apparently both you and Mike consider what you write to be
>> self-explanatory.
>
> git blame lily/lexer.ll|grep "//\|/\*"|wc -l
> 146
>
> git blame lily/lexer.ll|grep "//\|/\*"|grep Kastrup|wc -l
> 120
>
> git blame lily/lexer.ll|wc -l
> 1382
>
> git blame lily/lexer.ll|grep Kastrup|wc -l
> 677
>
> Are you sure that your characterization is fair?  I'm responsible for
> less than half the lines in the lexer, but for more than 80% of the
> lines starting a comment in the lexer.

That's very commendable, but i think you missed my point.  I didn't
say that you don't put comments in your code.  I said that _what you
write_ (i.e. code+comments that you write) is not self-explanatory for
me.  It's quite probable that i'm simply too dumb or unskilled to
understand things that an average programmer should understand.

> When my typical complaint with a commit from Mike focuses on the
> _number_ of comments, it's usually because there are about 10 lines of
> comments in 5000 lines of code (which seems indeed out of proportion
> based purely on the numbers, particularly when the whole _framework_
> put together in those 5000 lines is non-trivial, opaque and mostly
> non-discoverable), and half of the comments are wrong.
>
> Now statistics can definitely be misleading as indeed a comment can be
> worthless and/or distracting and always is in danger of running out of
> sync with the code.  So it needs to have value _separate_ from the
> code in order to be worth it.  If it repeats the story spelled out in
> the code (and this is what you ask for here),

Note that only first two lines of my reply was about this particular
patch.  Everything else was said about my general experience.  So, i'm
not insisting that there should be a comment here.

>> Maybe you are right that for an experienced developer Mike's code
>> isn't self-explanatory, and your code is.  All i know is that for me
>> neither is self-explanatory.
>
> So you say that a pattern written starting with
>
> [^.*|...
>
> does not tell you that it is supposed to match something not starting
> with a . * | and whatever else is listed here.  That's a matter of not
> knowing Flex and/or regular expressions, not a matter of not being
> able to follow the logic of the code.

Yes, you're right.

> That's like asking for a comment like
>
>     x += 2;  // increase x by 2
>
> which is not helpful.

yes, you're right.

>> Of course, i'm not an experienced
>> programmer.  But then, i've been working on LilyPond since 3 years
>> now, and that seems a pretty long time.
>>
>> I am sorry that (apparently) you don't care whether i can understand
>> your patches easily or not.
>
>
> You will understand a patch to the lexer _only_ if you know the
> language the lexer is written in.  A code review that has to rely on
> _comments_ in order to "understand" every facet of the code (rather
> than larger contexts and/or its design) is basically useless as any
> divergence between code and comment can't be detected.

yes, you're right.

>> Also, from my perspective, it seems that
>> you consider yourself to be always right:
>> "i think this deserves a regtest" "no, it doesn't"
>
>
> If you consider "no, it doesn't" as the same as "a regtest in that
> area should at least cover that and that cases.  Would you like to
> propose one?", sure.
>
> Can you point out to any case where I flat out stated that a regtest
> would not be warranted?

No, i don't have such example.

>> "i think this deserves a comment" "no, it doesn't"
>
> Can you please propose a comment that does not
>
> a) talk about a state that's not actually in the code and won't get
>    there accidentally
> b) is not _immediately_ _literally_ obvious from the code for anybody
>    knowing the language that something is written in?

No, i cannot.

> Comments should increase the signal/noise ratio of a program, not
> decrease it.  They need to tell the story that is _not_ explicitly
> coded.

yes, you're right.

>> I suppose that you're not doing this intentionally.  But it drives
>> me crazy anyway.  Anyway, it seems that when i try to review your
>> patches the first and foremost result is that we both loose time,
>
> Does that mean that I can save myself the effort to _explain_ my
> decisions since you would consider it a loss of time to try
> understanding them?

Not really.  I think that you can save yourself the effort to explain
your decisions - at least in this particular case - because that's an
ineffective use of your time.  Also, having me understand your
decisions is not required for anything.

In any case, i didn't ask for explanations in the first place.  I just
suggested adding a comment, without requiring you to explain yourself
if you didn't consider adding a comment appropriate.

> You _are_ aware that it takes much less effort to put in a useless
> comment rather than explain why it wouldn't help in a particular case?

Yes, i am.

>> so i suppose that i should stop reviewing your patches
>
> Depends on your goals.

My goal is to do something useful for lilypond.  I don't think this
discussion is useful for lilypond :-(
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b